@steveyuowo/vue-hot-toast
Advanced tools
Comparing version 0.0.0-alpha-testing5 to 1.0.0
import _sfc_main from "/Users/steveyu/VscodeProjects/vue-hot-toast/src/components/Toast.vue?vue&type=script&setup=true&lang.ts"; | ||
export * from "/Users/steveyu/VscodeProjects/vue-hot-toast/src/components/Toast.vue?vue&type=script&setup=true&lang.ts"; | ||
import "/Users/steveyu/VscodeProjects/vue-hot-toast/src/components/Toast.vue?vue&type=style&index=0&lang.css"; | ||
export default _sfc_main; | ||
//# sourceMappingURL=Toast.vue.d.ts.map |
import Toast from "@/components/Toast.vue"; | ||
import { toast } from "@/core/store"; | ||
import "./styles/index.scss"; | ||
export { Toast, toast }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,22 +0,12 @@ | ||
import { openBlock as s, createElementBlock as _, defineComponent as y, ref as u, onMounted as m, normalizeStyle as g, withModifiers as h, createElementVNode as i, createBlock as r, createCommentVNode as l, toDisplayString as k, reactive as T, Teleport as C, createVNode as I, TransitionGroup as $, withCtx as V, Fragment as H, renderList as w, unref as v } from "vue"; | ||
const p = (e, t) => { | ||
const n = e.__vccOpts || e; | ||
for (const [a, o] of t) | ||
n[a] = o; | ||
return n; | ||
}, B = {}, D = { class: "loading" }; | ||
function E(e, t) { | ||
return s(), _("div", D); | ||
} | ||
const M = /* @__PURE__ */ p(B, [["render", E], ["__scopeId", "data-v-5f922e80"]]); | ||
const S = {}, b = { class: "error" }; | ||
function L(e, t) { | ||
return s(), _("div", b); | ||
} | ||
const N = /* @__PURE__ */ p(S, [["render", L], ["__scopeId", "data-v-75aa13c2"]]); | ||
const O = {}, U = { class: "checkmark" }; | ||
function j(e, t) { | ||
return s(), _("div", U); | ||
} | ||
const z = /* @__PURE__ */ p(O, [["render", j], ["__scopeId", "data-v-6ff5e11a"]]), A = ["onClick"], F = { class: "VueHotToast__icon" }, G = { class: "content" }, q = { class: "content__message" }, J = /* @__PURE__ */ y({ | ||
import { defineComponent as f, ref as u, onMounted as y, openBlock as n, createElementBlock as r, normalizeStyle as g, withModifiers as v, createElementVNode as c, createCommentVNode as d, toDisplayString as T, reactive as h, createBlock as x, Teleport as k, createVNode as C, TransitionGroup as V, withCtx as H, Fragment as w, renderList as B, unref as m } from "vue"; | ||
const D = ["onClick"], M = { class: "VueHotToast__icon" }, S = { | ||
key: 0, | ||
class: "VueHotToast__checkmark" | ||
}, b = { | ||
key: 1, | ||
class: "VueHotToast__error" | ||
}, I = { | ||
key: 2, | ||
class: "VueHotToast__loading" | ||
}, N = { class: "content" }, $ = { class: "content__message" }, E = /* @__PURE__ */ f({ | ||
__name: "ToastItem", | ||
@@ -31,26 +21,26 @@ props: { | ||
emits: ["close"], | ||
setup(e, { emit: t }) { | ||
const n = e, a = u(null), o = u(0), x = u(0); | ||
m(() => { | ||
n.autoClose && (o.value = Date.now(), x.value = n.duration * 1e3, a.value = setTimeout(f, x.value)); | ||
setup(t, { emit: o }) { | ||
const s = t, a = u(null), e = u(0), _ = u(0); | ||
y(() => { | ||
s.autoClose && (e.value = Date.now(), _.value = s.duration * 1e3, a.value = setTimeout(p, _.value)); | ||
}); | ||
const f = () => { | ||
t("close"); | ||
const p = () => { | ||
o("close"); | ||
}; | ||
return (c, W) => (s(), _("div", { | ||
return (i, A) => (n(), r("div", { | ||
class: "VueHotToast__toast", | ||
style: g(`--toast-duration: ${c.duration}s;`), | ||
onClick: h(f, ["prevent"]) | ||
style: g(`--toast-duration: ${i.duration}s;`), | ||
onClick: v(p, ["prevent"]) | ||
}, [ | ||
i("div", F, [ | ||
c.type === "loading" ? (s(), r(M, { key: 0 })) : l("", !0), | ||
c.type === "error" ? (s(), r(N, { key: 1 })) : l("", !0), | ||
c.type === "success" ? (s(), r(z, { key: 2 })) : l("", !0) | ||
c("div", M, [ | ||
i.type === "success" ? (n(), r("div", S)) : d("", !0), | ||
i.type === "error" ? (n(), r("div", b)) : d("", !0), | ||
i.type === "loading" ? (n(), r("div", I)) : d("", !0) | ||
]), | ||
i("div", G, [ | ||
i("p", q, k(c.message), 1) | ||
c("div", N, [ | ||
c("p", $, T(i.message), 1) | ||
]) | ||
], 12, A)); | ||
], 12, D)); | ||
} | ||
}), K = { | ||
}), O = { | ||
type: "info", | ||
@@ -61,27 +51,27 @@ message: "Here's your toast.", | ||
}; | ||
function P() { | ||
let e = (/* @__PURE__ */ new Date()).getTime(); | ||
var t = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(n) { | ||
var a = (e + Math.random() * 16) % 16 | 0; | ||
return e = Math.floor(e / 16), (n == "x" ? a : a & 3 | 8).toString(16); | ||
function U() { | ||
let t = (/* @__PURE__ */ new Date()).getTime(); | ||
var o = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) { | ||
var a = (t + Math.random() * 16) % 16 | 0; | ||
return t = Math.floor(t / 16), (s == "x" ? a : a & 3 | 8).toString(16); | ||
}); | ||
return t; | ||
return o; | ||
} | ||
const d = T({ | ||
const l = h({ | ||
notifications: [] | ||
}), Y = (e) => { | ||
const t = Object.assign({ ...K }, e); | ||
d.notifications.push({ | ||
id: P(), | ||
...t | ||
}), G = (t) => { | ||
const o = Object.assign({ ...O }, t); | ||
l.notifications.push({ | ||
id: U(), | ||
...o | ||
}); | ||
}, Q = (e) => { | ||
const t = d.notifications.findIndex((n) => n.id === e); | ||
t !== -1 && d.notifications.splice(t, 1); | ||
}, R = { class: "VueHotToast__toast-container" }, Z = /* @__PURE__ */ y({ | ||
}, j = (t) => { | ||
const o = l.notifications.findIndex((s) => s.id === t); | ||
o !== -1 && l.notifications.splice(o, 1); | ||
}, z = { class: "VueHotToast__toast-container" }, L = /* @__PURE__ */ f({ | ||
__name: "Toast", | ||
setup(e) { | ||
const t = d.notifications; | ||
return (n, a) => (s(), r(C, { to: "body" }, [ | ||
I($, { | ||
setup(t) { | ||
const o = l.notifications; | ||
return (s, a) => (n(), x(k, { to: "body" }, [ | ||
C(V, { | ||
name: "VueHotToast__teleport-transition", | ||
@@ -91,13 +81,13 @@ tag: "div", | ||
}, { | ||
default: V(() => [ | ||
i("div", R, [ | ||
(s(!0), _(H, null, w(v(t), (o) => (s(), r(J, { | ||
key: o.id, | ||
id: o.id, | ||
type: o.type, | ||
message: o.message, | ||
"auto-close": o.autoClose, | ||
duration: o.duration, | ||
default: H(() => [ | ||
c("div", z, [ | ||
(n(!0), r(w, null, B(m(o), (e) => (n(), x(E, { | ||
key: e.id, | ||
id: e.id, | ||
type: e.type, | ||
message: e.message, | ||
"auto-close": e.autoClose, | ||
duration: e.duration, | ||
onClose: () => { | ||
v(Q)(o.id); | ||
m(j)(e.id); | ||
} | ||
@@ -113,4 +103,4 @@ }, null, 8, ["id", "type", "message", "auto-close", "duration", "onClose"]))), 128)) | ||
export { | ||
Z as Toast, | ||
Y as toast | ||
L as Toast, | ||
G as toast | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c["vue-hot-toast"]={},c.Vue))})(this,function(c,e){"use strict";const O="",_=(t,o)=>{const s=t.__vccOpts||t;for(const[a,n]of o)s[a]=n;return s},p={},f={class:"loading"};function x(t,o){return e.openBlock(),e.createElementBlock("div",f)}const m=_(p,[["render",x],["__scopeId","data-v-5f922e80"]]),j="",u={},y={class:"error"};function k(t,o){return e.openBlock(),e.createElementBlock("div",y)}const h=_(u,[["render",k],["__scopeId","data-v-75aa13c2"]]),L="",g={},B={class:"checkmark"};function T(t,o){return e.openBlock(),e.createElementBlock("div",B)}const C=_(g,[["render",T],["__scopeId","data-v-6ff5e11a"]]),V=["onClick"],I={class:"VueHotToast__icon"},E={class:"content"},$={class:"content__message"},N=e.defineComponent({__name:"ToastItem",props:{id:{},type:{},message:{},autoClose:{type:Boolean},duration:{}},emits:["close"],setup(t,{emit:o}){const s=t,a=e.ref(null),n=e.ref(0),l=e.ref(0);e.onMounted(()=>{s.autoClose&&(n.value=Date.now(),l.value=s.duration*1e3,a.value=setTimeout(d,l.value))});const d=()=>{o("close")};return(r,z)=>(e.openBlock(),e.createElementBlock("div",{class:"VueHotToast__toast",style:e.normalizeStyle(`--toast-duration: ${r.duration}s;`),onClick:e.withModifiers(d,["prevent"])},[e.createElementVNode("div",I,[r.type==="loading"?(e.openBlock(),e.createBlock(m,{key:0})):e.createCommentVNode("",!0),r.type==="error"?(e.openBlock(),e.createBlock(h,{key:1})):e.createCommentVNode("",!0),r.type==="success"?(e.openBlock(),e.createBlock(C,{key:2})):e.createCommentVNode("",!0)]),e.createElementVNode("div",E,[e.createElementVNode("p",$,e.toDisplayString(r.message),1)])],12,V))}}),H={type:"info",message:"Here's your toast.",autoClose:!0,duration:5};function S(){let t=new Date().getTime();var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){var a=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?a:a&3|8).toString(16)});return o}const i=e.reactive({notifications:[]}),b=t=>{const o=Object.assign({...H},t);i.notifications.push({id:S(),...o})},M=t=>{const o=i.notifications.findIndex(s=>s.id===t);o!==-1&&i.notifications.splice(o,1)},w={class:"VueHotToast__toast-container"},D=e.defineComponent({__name:"Toast",setup(t){const o=i.notifications;return(s,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.TransitionGroup,{name:"VueHotToast__teleport-transition",tag:"div",class:"VueHotToast__teleport-transition"},{default:e.withCtx(()=>[e.createElementVNode("div",w,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),n=>(e.openBlock(),e.createBlock(N,{key:n.id,id:n.id,type:n.type,message:n.message,"auto-close":n.autoClose,duration:n.duration,onClose:()=>{e.unref(M)(n.id)}},null,8,["id","type","message","auto-close","duration","onClose"]))),128))])]),_:1})]))}}),U="",q="";c.Toast=D,c.toast=b,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}); | ||
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s["vue-hot-toast"]={},s.Vue))})(this,function(s,t){"use strict";const _=["onClick"],p={class:"VueHotToast__icon"},f={key:0,class:"VueHotToast__checkmark"},m={key:1,class:"VueHotToast__error"},u={key:2,class:"VueHotToast__loading"},x={class:"content"},y={class:"content__message"},k=t.defineComponent({__name:"ToastItem",props:{id:{},type:{},message:{},autoClose:{type:Boolean},duration:{}},emits:["close"],setup(e,{emit:o}){const a=e,i=t.ref(null),n=t.ref(0),l=t.ref(0);t.onMounted(()=>{a.autoClose&&(n.value=Date.now(),l.value=a.duration*1e3,i.value=setTimeout(d,l.value))});const d=()=>{o("close")};return(c,E)=>(t.openBlock(),t.createElementBlock("div",{class:"VueHotToast__toast",style:t.normalizeStyle(`--toast-duration: ${c.duration}s;`),onClick:t.withModifiers(d,["prevent"])},[t.createElementVNode("div",p,[c.type==="success"?(t.openBlock(),t.createElementBlock("div",f)):t.createCommentVNode("",!0),c.type==="error"?(t.openBlock(),t.createElementBlock("div",m)):t.createCommentVNode("",!0),c.type==="loading"?(t.openBlock(),t.createElementBlock("div",u)):t.createCommentVNode("",!0)]),t.createElementVNode("div",x,[t.createElementVNode("p",y,t.toDisplayString(c.message),1)])],12,_))}}),h={type:"info",message:"Here's your toast.",autoClose:!0,duration:5};function T(){let e=new Date().getTime();var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var i=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(a=="x"?i:i&3|8).toString(16)});return o}const r=t.reactive({notifications:[]}),g=e=>{const o=Object.assign({...h},e);r.notifications.push({id:T(),...o})},V=e=>{const o=r.notifications.findIndex(a=>a.id===e);o!==-1&&r.notifications.splice(o,1)},B={class:"VueHotToast__toast-container"},C=t.defineComponent({__name:"Toast",setup(e){const o=r.notifications;return(a,i)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.TransitionGroup,{name:"VueHotToast__teleport-transition",tag:"div",class:"VueHotToast__teleport-transition"},{default:t.withCtx(()=>[t.createElementVNode("div",B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),n=>(t.openBlock(),t.createBlock(k,{key:n.id,id:n.id,type:n.type,message:n.message,"auto-close":n.autoClose,duration:n.duration,onClose:()=>{t.unref(V)(n.id)}},null,8,["id","type","message","auto-close","duration","onClose"]))),128))])]),_:1})]))}});s.Toast=C,s.toast=g,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "@steveyuowo/vue-hot-toast", | ||
"version": "0.0.0-alpha-testing5", | ||
"version": "1.0.0", | ||
"type": "module", | ||
@@ -25,4 +25,4 @@ "files": [ | ||
"dev": "vite", | ||
"build": "vue-tsc && vite build", | ||
"preview": "vite preview" | ||
"compile-css": "node-sass ./src/styles/index.scss ./dist/vue-hot-toast.css", | ||
"build": "vue-tsc && vite build && pnpm compile-css" | ||
}, | ||
@@ -35,2 +35,3 @@ "dependencies": { | ||
"@vitejs/plugin-vue": "^4.2.3", | ||
"node-sass": "^9.0.0", | ||
"prettier": "^3.0.3", | ||
@@ -37,0 +38,0 @@ "rollup-plugin-typescript2": "^0.36.0", |
import Toast from "@/components/Toast.vue"; | ||
import { toast } from "@/core/store"; | ||
import "./styles/index.scss"; | ||
@@ -5,0 +4,0 @@ export { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
343
2
20718
9
27
1