New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vavt/message

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vavt/message - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

2

lib/index.umd.js

@@ -1,1 +0,1 @@

(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.VavtMessage={}))})(this,function(o){"use strict";var T=(o,e,s)=>{if(!e.has(o))throw TypeError("Cannot "+s)};var i=(o,e,s)=>(T(o,e,"read from private field"),s?s.call(o):e.get(o)),u=(o,e,s)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,s)},v=(o,e,s,b)=>(T(o,e,"write to private field"),b?b.call(o,s):e.set(o,s),s);var c=(o,e,s)=>(T(o,e,"access private method"),s);var h,d,p,E,S,f,$,m,L,M;const e="vavt",s=`@keyframes ${e}FadeInDown{0%{opacity:0;transform:translate3d(-50%,-100%,0)}to{opacity:1;transform:translate3d(-50%,0,0)}}@keyframes ${e}FadeOutUp{0%{opacity:1}to{opacity:0;transform:translate3d(-50%,-100%,0)}}.${e}-fid{animation-name:${e}FadeInDown;animation-duration:.3s;animation-fill-mode:both}.${e}-fou{animation-name:${e}FadeOutUp;animation-duration:.3s;animation-fill-mode:both}.${e}-message{position:fixed;left:50%;transform:translate(-50%);padding:10px 16px;border-radius:4px;color:#fff;font-size:14px;line-height:normal;transition:top .5s ease}.${e}-message.${e}-closeable{padding:10px 40px 10px 16px}.${e}-icon{width:18px;height:18px;margin-right:8px;vertical-align:sub}.${e}-icon-close{width:16px;height:16px;margin-right:0;cursor:pointer;position:absolute;right:16px;top:50%;transform:translateY(-50%)}.${e}-message-info{color:#333;background-color:#e3e3e3}.${e}-message-warning{color:#ff9104;background-color:#ffe9cc}.${e}-message-success{color:#00c852;background-color:#c1f1d5}.${e}-message-error{color:#d32f2f;background-color:#ffd8d8}:root[data-theme=dark] .${e}-message-info{color:#999;background-color:#212121}:root[data-theme=dark] .${e}-message-warning{color:#ed8500;background-color:#3c2200}:root[data-theme=dark] .${e}-message-success{color:#00c551;background-color:#003014}:root[data-theme=dark] .${e}-message-error{color:#ef1d1d;background-color:#3b0000}`,b=`${e}-message-css`,A={info:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M53.312 512a458.688 458.688 0 1 0 917.376 0A458.688 458.688 0 0 0 53.312 512z m445.12-41.472a63.488 63.488 0 0 1 37.504 17.536 63.488 63.488 0 0 1 17.6 37.504c1.152 8.768 1.152 18.88 1.152 27.392v172.352a42.688 42.688 0 1 1-85.376 0V554.688a42.688 42.688 0 1 1 0-85.376h1.728c8.512 0 18.688 0 27.392 1.216z m13.376-171.84h0.384c23.488 0 42.496 19.072 42.496 42.624A42.56 42.56 0 0 1 512.192 384h-0.384a42.56 42.56 0 0 1-42.496-42.688c0-23.552 19.008-42.624 42.496-42.624z" fill="currentColor"></path></svg>`,warning:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M512 62a450 450 0 1 0 450 450 450 450 0 0 0-450-450z m0 705.9375a47.8125 47.8125 0 0 1-47.8125-47.8125 47.8125 47.8125 0 1 1 95.625 0 47.8125 47.8125 0 0 1-47.8125 47.8125z m47.8125-240.1875a47.8125 47.8125 0 1 1-95.625 0v-225a47.8125 47.8125 0 0 1 95.625 0z" fill="currentColor"></path></svg>`,success:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M830.26919551 193.71282208A448.95978018 448.95978018 0 0 0 511.99736328 62.00182813a448.163492 448.163492 0 0 0-318.26919551 131.71099394c-175.62110362 175.49981455-175.62110362 461.0579124 1e-8 636.55684804a448.21534747 448.21534747 0 0 0 318.2691955 131.71099395A447.25118818 447.25118818 0 0 0 830.26919551 830.26967012c175.63780283-175.49981455 175.63780283-461.0579124-1e-8-636.55684804zM778.25821484 394.41173135L475.96400263 716.0225249a13.49998594 13.49998594 0 0 1-5.17499472 3.59999648c-1.53984199 1.0379874-2.56113018 2.07685372-4.63798301 2.56113018a30.32223398 30.32223398 0 0 1-11.83885488 2.56200909 40.03237969 40.03237969 0 0 1-11.33612051-2.02499825l-3.59999649-2.07773173a39.80737969 39.80737969 0 0 1-6.16112578-3.59999649l-173.0590954-170.32306289a29.99440195 29.99440195 0 0 1-9.27772471-22.13698799c0-8.23885839 3.14999648-16.47683789 8.77499121-22.13698887a32.01852129 32.01852129 0 0 1 44.27309795 0l149.3998418 147.14984531L732.94800927 352.23306523a32.57223135 32.57223135 0 0 1 44.27221905-1.52314277 29.57340674 29.57340674 0 0 1 9.81385665 22.13698799 31.24069013 31.24069013 0 0 1-8.77499122 21.59997715v-0.03515625z m0 0" fill="currentColor"></path></svg>`,error:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M544.55882363 512l146.06470548-146.11764727a23.18823545 23.18823545 0 0 0 0-32.50588184 23.18823545 23.18823545 0 0 0-32.55882364 0L512 479.49411729l-146.11764727-146.1176464a23.18823545 23.18823545 0 0 0-32.50588184 0 23.18823545 23.18823545 0 0 0 0 32.55882364L479.49411729 512l-146.1176464 146.11764727a23.18823545 23.18823545 0 0 0 0 32.50588184 23.18823545 23.18823545 0 0 0 32.55882364 0L512 544.50588271l146.11764727 146.1176464a23.18823545 23.18823545 0 0 0 32.50588184 0 23.18823545 23.18823545 0 0 0 0-32.55882364L544.50588271 512zM512 962a450 450 0 1 1 0-900 450 450 0 0 1 0 900z" fill="currentColor"></path></svg>`},D=`<svg class="${e}-icon ${e}-icon-close" viewBox="0 0 1024 1024"><path d="M777.55733333 174.08L512 439.63733333 246.44266667 174.08a51.2 51.2 0 0 0-72.36266667 72.36266667L439.63733333 512l-265.55733333 265.55733333A51.2 51.2 0 0 0 246.44266667 853.33333333L512 584.36266667 777.55733333 853.33333333A51.2 51.2 0 0 0 853.33333333 777.55733333L584.36266667 512 853.33333333 246.44266667a51.2 51.2 0 0 0-72.36266666-72.36266667z" fill="currentColor"></path></svg>`,k=`${e}-fou`,C=`${e}-fid`,y=":root[data-theme=dark]",z=(M=class{constructor(){u(this,E);u(this,f);u(this,m);u(this,h,{class:"",single:!1,offsetTop:20,duration:3e3,closeable:!1,darkSelector:y,zIndex:9999});u(this,d,new Set);u(this,p,0)}info(t,n){const l=c(this,m,L).call(this,"info",t,n);return()=>{c(this,f,$).call(this,l)}}warning(t,n){const l=c(this,m,L).call(this,"warning",t,n);return()=>{c(this,f,$).call(this,l)}}success(t,n){const l=c(this,m,L).call(this,"success",t,n);return()=>{c(this,f,$).call(this,l)}}error(t,n){const l=c(this,m,L).call(this,"error",t,n);return()=>{c(this,f,$).call(this,l)}}closeAll(){v(this,p,0),i(this,d).forEach(({ele:t})=>{t.classList.add(k),t.addEventListener("animationend",()=>{t.remove()})}),i(this,d).clear()}config(t={}){v(this,h,{...i(this,h),...t})}},h=new WeakMap,d=new WeakMap,p=new WeakMap,E=new WeakSet,S=function(){let t=document.querySelector(`#${b}`);t||(t=document.createElement("style"),t.innerHTML=s.replace(y,i(this,h).darkSelector),t.id=b,document.head.appendChild(t))},f=new WeakSet,$=function(t){if(!i(this,d).has(t))return!1;const{ele:n,top:l}=t;n.classList.add(k);const r=t.offsetTop+t.ele.offsetHeight;v(this,p,i(this,p)-r),i(this,d).delete(t),i(this,d).forEach(g=>{g.top>l&&(g.top-=r,g.ele.style.top=`${g.top}px`)}),n.addEventListener("animationend",()=>{n.remove()})},m=new WeakSet,L=function(t,n,l={}){c(this,E,S).call(this);const r={...i(this,h),...l};r.single&&this.closeAll();const g=v(this,p,i(this,p)+r.offsetTop),a=document.createElement("div"),w={ele:a,top:g,offsetTop:r.offsetTop};if(i(this,d).add(w),a.innerHTML=`${A[t]}${n}`,r.closeable){const x=new DOMParser().parseFromString(D,"text/html").body.firstElementChild;x.addEventListener("click",()=>{c(this,f,$).call(this,w)}),a.classList.add(`${e}-closeable`),a.appendChild(x)}if(a.classList.add(`${e}-message`,`${e}-message-${t}`,C),r.class&&a.classList.add(r.class),a.style.top=`${g}px`,a.style.zIndex=`${r.zIndex}`,document.body.appendChild(a),v(this,p,i(this,p)+a.offsetHeight),a.addEventListener("animationend",()=>{a.classList.remove(C)}),r.duration>0){let x=-1;const O=()=>{x=window.setTimeout(()=>{c(this,f,$).call(this,w)},r.duration)};O(),a.addEventListener("mouseenter",()=>{clearTimeout(x)}),a.addEventListener("mouseleave",O)}return w},M),F=new z;o.Message=z,o.message=F,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.VavtMessage={}))})(this,function(t){"use strict";var M=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var c=(t,e,n)=>(M(t,e,"read from private field"),n?n.call(t):e.get(t)),g=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},v=(t,e,n,L)=>(M(t,e,"write to private field"),L?L.call(t,n):e.set(t,n),n);var l=(t,e,n)=>(M(t,e,"access private method"),n);var h,d,p,w,A,f,$,m,T,O;const e="vavt",n=`@keyframes ${e}FadeInDown{0%{opacity:0;transform:translate3d(-50%,-100%,0)}to{opacity:1;transform:translate3d(-50%,0,0)}}@keyframes ${e}FadeOutUp{0%{opacity:1}to{opacity:0;transform:translate3d(-50%,-100%,0)}}.${e}-fid{animation-name:${e}FadeInDown;animation-duration:.3s;animation-fill-mode:both}.${e}-fou{animation-name:${e}FadeOutUp;animation-duration:.3s;animation-fill-mode:both}.${e}-message{position:fixed;left:50%;transform:translate(-50%);padding:10px 16px;border-radius:4px;color:#fff;font-size:14px;line-height:normal;transition:top .5s ease}.${e}-message.${e}-closeable{padding:10px 40px 10px 16px}.${e}-icon{width:18px;height:18px;margin-right:8px;vertical-align:sub}.${e}-icon-close{width:16px;height:16px;margin-right:0;cursor:pointer;position:absolute;right:16px;top:50%;transform:translateY(-50%)}.${e}-message-info{color:#333;background-color:#e3e3e3}.${e}-message-warning{color:#ff9104;background-color:#ffe9cc}.${e}-message-success{color:#00c852;background-color:#c1f1d5}.${e}-message-error{color:#d32f2f;background-color:#ffd8d8}:root[data-theme=dark] .${e}-message-info{color:#999;background-color:#212121}:root[data-theme=dark] .${e}-message-warning{color:#ed8500;background-color:#3c2200}:root[data-theme=dark] .${e}-message-success{color:#00c551;background-color:#003014}:root[data-theme=dark] .${e}-message-error{color:#ef1d1d;background-color:#3b0000}`,L=`${e}-message-css`,b={info:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M53.312 512a458.688 458.688 0 1 0 917.376 0A458.688 458.688 0 0 0 53.312 512z m445.12-41.472a63.488 63.488 0 0 1 37.504 17.536 63.488 63.488 0 0 1 17.6 37.504c1.152 8.768 1.152 18.88 1.152 27.392v172.352a42.688 42.688 0 1 1-85.376 0V554.688a42.688 42.688 0 1 1 0-85.376h1.728c8.512 0 18.688 0 27.392 1.216z m13.376-171.84h0.384c23.488 0 42.496 19.072 42.496 42.624A42.56 42.56 0 0 1 512.192 384h-0.384a42.56 42.56 0 0 1-42.496-42.688c0-23.552 19.008-42.624 42.496-42.624z" fill="currentColor"></path></svg>`,warning:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M512 62a450 450 0 1 0 450 450 450 450 0 0 0-450-450z m0 705.9375a47.8125 47.8125 0 0 1-47.8125-47.8125 47.8125 47.8125 0 1 1 95.625 0 47.8125 47.8125 0 0 1-47.8125 47.8125z m47.8125-240.1875a47.8125 47.8125 0 1 1-95.625 0v-225a47.8125 47.8125 0 0 1 95.625 0z" fill="currentColor"></path></svg>`,success:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M830.26919551 193.71282208A448.95978018 448.95978018 0 0 0 511.99736328 62.00182813a448.163492 448.163492 0 0 0-318.26919551 131.71099394c-175.62110362 175.49981455-175.62110362 461.0579124 1e-8 636.55684804a448.21534747 448.21534747 0 0 0 318.2691955 131.71099395A447.25118818 447.25118818 0 0 0 830.26919551 830.26967012c175.63780283-175.49981455 175.63780283-461.0579124-1e-8-636.55684804zM778.25821484 394.41173135L475.96400263 716.0225249a13.49998594 13.49998594 0 0 1-5.17499472 3.59999648c-1.53984199 1.0379874-2.56113018 2.07685372-4.63798301 2.56113018a30.32223398 30.32223398 0 0 1-11.83885488 2.56200909 40.03237969 40.03237969 0 0 1-11.33612051-2.02499825l-3.59999649-2.07773173a39.80737969 39.80737969 0 0 1-6.16112578-3.59999649l-173.0590954-170.32306289a29.99440195 29.99440195 0 0 1-9.27772471-22.13698799c0-8.23885839 3.14999648-16.47683789 8.77499121-22.13698887a32.01852129 32.01852129 0 0 1 44.27309795 0l149.3998418 147.14984531L732.94800927 352.23306523a32.57223135 32.57223135 0 0 1 44.27221905-1.52314277 29.57340674 29.57340674 0 0 1 9.81385665 22.13698799 31.24069013 31.24069013 0 0 1-8.77499122 21.59997715v-0.03515625z m0 0" fill="currentColor"></path></svg>`,error:`<svg class="${e}-icon" viewBox="0 0 1024 1024"><path d="M544.55882363 512l146.06470548-146.11764727a23.18823545 23.18823545 0 0 0 0-32.50588184 23.18823545 23.18823545 0 0 0-32.55882364 0L512 479.49411729l-146.11764727-146.1176464a23.18823545 23.18823545 0 0 0-32.50588184 0 23.18823545 23.18823545 0 0 0 0 32.55882364L479.49411729 512l-146.1176464 146.11764727a23.18823545 23.18823545 0 0 0 0 32.50588184 23.18823545 23.18823545 0 0 0 32.55882364 0L512 544.50588271l146.11764727 146.1176464a23.18823545 23.18823545 0 0 0 32.50588184 0 23.18823545 23.18823545 0 0 0 0-32.55882364L544.50588271 512zM512 962a450 450 0 1 1 0-900 450 450 0 0 1 0 900z" fill="currentColor"></path></svg>`},D=`<svg class="${e}-icon ${e}-icon-close" viewBox="0 0 1024 1024"><path d="M777.55733333 174.08L512 439.63733333 246.44266667 174.08a51.2 51.2 0 0 0-72.36266667 72.36266667L439.63733333 512l-265.55733333 265.55733333A51.2 51.2 0 0 0 246.44266667 853.33333333L512 584.36266667 777.55733333 853.33333333A51.2 51.2 0 0 0 853.33333333 777.55733333L584.36266667 512 853.33333333 246.44266667a51.2 51.2 0 0 0-72.36266666-72.36266667z" fill="currentColor"></path></svg>`,k=`${e}-fou`,C=`${e}-fid`,y=":root[data-theme=dark]",z=(O=class{constructor(){g(this,w);g(this,f);g(this,m);g(this,h,{class:"",single:!1,offsetTop:20,duration:3e3,closeable:!1,darkSelector:y,zIndex:9999});g(this,d,new Set);g(this,p,0)}info(o,r){const a=l(this,m,T).call(this,"info",o,r);return{close:()=>{l(this,f,$).call(this,a)},update:s=>{a.ele.innerHTML=`${b.info}${s}`}}}warning(o,r){const a=l(this,m,T).call(this,"warning",o,r);return{close:()=>{l(this,f,$).call(this,a)},update:s=>{a.ele.innerHTML=`${b.warning}${s}`}}}success(o,r){const a=l(this,m,T).call(this,"success",o,r);return{close:()=>{l(this,f,$).call(this,a)},update:s=>{a.ele.innerHTML=`${b.success}${s}`}}}error(o,r){const a=l(this,m,T).call(this,"error",o,r);return{close:()=>{l(this,f,$).call(this,a)},update:s=>{a.ele.innerHTML=`${b.error}${s}`}}}closeAll(){v(this,p,0),c(this,d).forEach(({ele:o})=>{o.classList.add(k),o.addEventListener("animationend",()=>{o.remove()})}),c(this,d).clear()}config(o={}){v(this,h,{...c(this,h),...o})}},h=new WeakMap,d=new WeakMap,p=new WeakMap,w=new WeakSet,A=function(){let o=document.querySelector(`#${L}`);o||(o=document.createElement("style"),o.innerHTML=n.replace(y,c(this,h).darkSelector),o.id=L,document.head.appendChild(o))},f=new WeakSet,$=function(o){if(!c(this,d).has(o))return!1;const{ele:r,top:a}=o;r.classList.add(k);const s=o.offsetTop+o.ele.offsetHeight;v(this,p,c(this,p)-s),c(this,d).delete(o),c(this,d).forEach(u=>{u.top>a&&(u.top-=s,u.ele.style.top=`${u.top}px`)}),r.addEventListener("animationend",()=>{r.remove()})},m=new WeakSet,T=function(o,r,a={}){l(this,w,A).call(this);const s={...c(this,h),...a};s.single&&this.closeAll();const u=v(this,p,c(this,p)+s.offsetTop),i=document.createElement("div"),E={ele:i,top:u,offsetTop:s.offsetTop};if(c(this,d).add(E),i.innerHTML=`${b[o]}${r}`,s.closeable){const x=new DOMParser().parseFromString(D,"text/html").body.firstElementChild;x.addEventListener("click",()=>{l(this,f,$).call(this,E)}),i.classList.add(`${e}-closeable`),i.appendChild(x)}if(i.classList.add(`${e}-message`,`${e}-message-${o}`,C),s.class&&i.classList.add(s.class),i.style.top=`${u}px`,i.style.zIndex=`${s.zIndex}`,document.body.appendChild(i),v(this,p,c(this,p)+i.offsetHeight),i.addEventListener("animationend",()=>{i.classList.remove(C)}),s.duration>0){let x=-1;const S=()=>{x=window.setTimeout(()=>{l(this,f,$).call(this,E)},s.duration)};S(),i.addEventListener("mouseenter",()=>{clearTimeout(x)}),i.addEventListener("mouseleave",S)}return E},O),F=new z;t.Message=z,t.message=F,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
{
"name": "@vavt/message",
"version": "1.0.1",
"version": "2.0.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "keywords": [

@@ -19,6 +19,12 @@ # @vavt/message

// error, success, info, warning
const closeFN = message.info('这是一条普通信息');
const { close, update } = message.info('这是一条普通信息');
// 更新内容
update('这是更新后的内容');
// 手动关闭
closeFN();
close();
// 关闭全部
message.closeAll();
```

@@ -25,0 +31,0 @@

@@ -30,6 +30,18 @@ interface MessageOptions {

"__#1@#showMessage"(type: MessageTypes, message: string, options?: MessageOptions): MessageObj;
info(message: string, options?: StrikeMessageOptions): () => void;
warning(message: string, options?: StrikeMessageOptions): () => void;
success(message: string, options?: StrikeMessageOptions): () => void;
error(message: string, options?: StrikeMessageOptions): () => void;
info(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
warning(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
success(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
error(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
closeAll(): void;

@@ -51,6 +63,18 @@ config(options?: MessageOptions): void;

"__#1@#showMessage"(type: MessageTypes, message: string, options?: MessageOptions): MessageObj;
info(message: string, options?: StrikeMessageOptions): () => void;
warning(message: string, options?: StrikeMessageOptions): () => void;
success(message: string, options?: StrikeMessageOptions): () => void;
error(message: string, options?: StrikeMessageOptions): () => void;
info(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
warning(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
success(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
error(message: string, options?: StrikeMessageOptions): {
close: () => void;
update: (newMessages: string) => void;
};
closeAll(): void;

@@ -57,0 +81,0 @@ config(options?: MessageOptions): void;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc