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

vue-sonner

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-sonner - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

6

lib/Toaster.vue.d.ts

@@ -30,7 +30,5 @@ import { Position, Theme, ToastOptions } from './types';

type: import("vue").PropType<number>;
default: NumberConstructor;
};
offset: {
type: import("vue").PropType<string | number>;
default: number;
};

@@ -82,7 +80,5 @@ position: {

type: import("vue").PropType<number>;
default: NumberConstructor;
};
offset: {
type: import("vue").PropType<string | number>;
default: number;
};

@@ -123,4 +119,2 @@ position: {

invert: boolean;
duration: number;
offset: string | number;
position: Position;

@@ -127,0 +121,0 @@ visibleToasts: number;

142

lib/vue-sonner.js

@@ -5,3 +5,3 @@ var ve = Object.defineProperty;

import "./index.css";
import { defineComponent as J, openBlock as u, createElementBlock as v, createElementVNode as C, Fragment as L, renderList as se, unref as R, ref as c, computed as f, onMounted as Y, watchEffect as S, onUnmounted as oe, normalizeClass as ee, normalizeStyle as G, createVNode as pe, createCommentVNode as w, createBlock as q, createTextVNode as te, toDisplayString as A, resolveDynamicComponent as me, useAttrs as he } from "vue";
import { defineComponent as J, openBlock as u, createElementBlock as v, createElementVNode as C, Fragment as V, renderList as se, unref as _, ref as c, computed as f, onMounted as Y, watchEffect as D, onUnmounted as oe, normalizeClass as ee, normalizeStyle as G, createVNode as pe, createCommentVNode as w, createBlock as q, createTextVNode as te, toDisplayString as R, resolveDynamicComponent as me, useAttrs as he } from "vue";
let O = 0;

@@ -56,3 +56,3 @@ class ye {

}), e;
}, be = ge, lt = Object.assign(be, {
}, be = ge, rt = Object.assign(be, {
success: B.success,

@@ -76,3 +76,3 @@ error: B.error,

C("div", xe, [
(u(!0), v(L, null, se(R(t), (h) => (u(), v("div", {
(u(!0), v(V, null, se(_(t), (h) => (u(), v("div", {
key: `spinner-bar-${h}`,

@@ -105,3 +105,3 @@ className: "sonner-loading-bar"

}
const Ee = /* @__PURE__ */ Q(ke, [["render", Ne]]), Pe = {}, Ie = {
const Ee = /* @__PURE__ */ Q(ke, [["render", Ne]]), Ie = {}, Pe = {
xmlns: "http://www.w3.org/2000/svg",

@@ -112,3 +112,3 @@ viewBox: "0 0 20 20",

width: "20"
}, De = /* @__PURE__ */ C("path", {
}, Se = /* @__PURE__ */ C("path", {
"fill-rule": "evenodd",

@@ -118,8 +118,8 @@ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",

}, null, -1), Oe = [
De
Se
];
function Se(s, t) {
return u(), v("svg", Ie, Oe);
function De(s, t) {
return u(), v("svg", Pe, Oe);
}
const Re = /* @__PURE__ */ Q(Pe, [["render", Se]]), _e = {}, Ae = {
const _e = /* @__PURE__ */ Q(Ie, [["render", De]]), Ae = {}, Re = {
xmlns: "http://www.w3.org/2000/svg",

@@ -149,5 +149,5 @@ width: "12",

function ze(s, t) {
return u(), v("svg", Ae, He);
return u(), v("svg", Re, He);
}
const Fe = /* @__PURE__ */ Q(_e, [["render", ze]]), Le = ["aria-live", "data-styled", "data-mounted", "data-promise", "data-removed", "data-visible", "data-y-position", "data-x-position", "data-index", "data-front", "data-swiping", "data-type", "data-invert", "data-swipe-out", "data-expanded"], Ve = ["data-disabled"], Ue = {
const Le = /* @__PURE__ */ Q(Ae, [["render", ze]]), Ve = ["aria-live", "data-styled", "data-mounted", "data-promise", "data-removed", "data-visible", "data-y-position", "data-x-position", "data-index", "data-front", "data-swiping", "data-type", "data-invert", "data-swipe-out", "data-expanded"], Fe = ["data-disabled"], Ue = {
key: 1,

@@ -213,7 +213,7 @@ "data-icon": ""

setup(s, { emit: t }) {
const e = s, o = (n) => !!n.promise, h = c(!1), y = c(!1), k = c(!1), I = c(!1), d = c(null), D = c(0), M = c(0), l = c(null), i = c(null), p = f(() => e.index === 0), T = f(() => e.index + 1 <= e.visibleToasts), $ = f(() => e.toast.type), N = e.toast.className || "", E = e.toast.descriptionClassName || "", H = e.toast.style || {}, z = f(
const e = s, o = (n) => !!n.promise, h = c(!1), y = c(!1), k = c(!1), P = c(!1), d = c(null), S = c(0), M = c(0), l = c(null), i = c(null), p = f(() => e.index === 0), T = f(() => e.index + 1 <= e.visibleToasts), $ = f(() => e.toast.type), N = e.toast.className || "", E = e.toast.descriptionClassName || "", H = e.toast.style || {}, z = f(
() => e.heights.findIndex((n) => n.toastId === e.toast.id) || 0
), ne = f(
() => e.toast.duration || e.duration || We
), V = c(0), _ = c(0), U = c(ne.value), X = c(0), F = c(null), j = f(() => e.position.split("-")), ie = f(() => e.heights.reduce((n, a, r) => r >= z.value ? n : n + a.height, 0)), ae = f(() => e.toast.invert || e.invert), K = f(() => d.value === "loading"), Z = f(
), F = c(0), A = c(0), U = c(ne.value), X = c(0), L = c(null), j = f(() => e.position.split("-")), ie = f(() => e.heights.reduce((n, a, r) => r >= z.value ? n : n + a.height, 0)), ae = f(() => e.toast.invert || e.invert), K = f(() => d.value === "loading"), Z = f(
() => d.value ?? (e.toast.type || null)

@@ -234,5 +234,5 @@ ), W = f(() => !o(e.toast) && typeof e.toast.title == "object"), le = f(() => {

});
Y(() => h.value = !0), S(() => {
_.value = z.value * Ye + ie.value;
}), S(() => {
Y(() => h.value = !0), D(() => {
A.value = z.value * Ye + ie.value;
}), D(() => {
var n, a;

@@ -254,6 +254,6 @@ if (e.toast && o(e.toast)) {

var n, a;
K.value || (P(), (a = (n = e.toast).onDismiss) == null || a.call(n, e.toast));
K.value || (I(), (a = (n = e.toast).onDismiss) == null || a.call(n, e.toast));
}
function P() {
y.value = !0, D.value = _.value;
function I() {
y.value = !0, S.value = A.value;
const n = e.heights.filter((a) => a.toastId !== e.toast.id);

@@ -265,6 +265,6 @@ t("update:heights", n), setTimeout(() => {

const ue = (n) => {
K || (D.value = _.value, n.target.setPointerCapture(n.pointerId), n.target.tagName !== "BUTTON" && (k.value = !0, F.value = n.clientY));
K || (S.value = A.value, n.target.setPointerCapture(n.pointerId), n.target.tagName !== "BUTTON" && (k.value = !0, L.value = n.clientY));
}, ce = (n) => {
var r, b, m, x;
if (I.value)
if (P.value)
return;

@@ -275,11 +275,11 @@ const a = Number(

if (Math.abs(a) >= Ge) {
D.value = _.value, (m = (b = e.toast).onDismiss) == null || m.call(b, e.toast), P(), I.value = !0;
S.value = A.value, (m = (b = e.toast).onDismiss) == null || m.call(b, e.toast), I(), P.value = !0;
return;
}
(x = i.value) == null || x.style.setProperty("--swipe-amount", "0px"), F.value = null, k.value = !0;
(x = i.value) == null || x.style.setProperty("--swipe-amount", "0px"), L.value = null, k.value = !0;
}, de = (n) => {
var b, m;
if (!F.value)
if (!L.value)
return;
const a = n.clientY - F.value;
const a = n.clientY - L.value;
if (!(j.value[0] === "top" ? a < 0 : a > 0)) {

@@ -291,3 +291,3 @@ (b = i.value) == null || b.style.setProperty("--swipe-amount", "0px");

};
return S((n) => {
return D((n) => {
if (e.toast.promise && d.value === "loading" || e.toast.duration === 1 / 0)

@@ -297,4 +297,4 @@ return;

const r = () => {
if (X.value < V.value) {
const m = (/* @__PURE__ */ new Date()).getTime() - V.value;
if (X.value < F.value) {
const m = (/* @__PURE__ */ new Date()).getTime() - F.value;
U.value = U.value - m;

@@ -304,5 +304,5 @@ }

}, b = () => {
V.value = (/* @__PURE__ */ new Date()).getTime(), a = setTimeout(() => {
F.value = (/* @__PURE__ */ new Date()).getTime(), a = setTimeout(() => {
var m, x;
(x = (m = e.toast).onAutoClose) == null || x.call(m, e.toast), P();
(x = (m = e.toast).onAutoClose) == null || x.call(m, e.toast), I();
}, U.value);

@@ -325,4 +325,4 @@ };

}
}), S(() => {
e.toast.delete && P();
}), D(() => {
e.toast.delete && I();
}), (n, a) => (u(), v("li", {

@@ -336,3 +336,3 @@ "aria-live": s.toast.important ? "assertive" : "polite",

"data-sonner-toast": "",
class: ee(R(N)),
class: ee(_(N)),
"data-styled": !W.value,

@@ -350,3 +350,3 @@ "data-mounted": h.value,

"data-invert": ae.value,
"data-swipe-out": I.value,
"data-swipe-out": P.value,
"data-expanded": !!(e.expanded || e.expandByDefault && h.value),

@@ -357,5 +357,5 @@ style: G({

"--z-index": s.toasts.length - e.index,
"--offset": `${y.value ? D.value : _.value}px`,
"--offset": `${y.value ? S.value : A.value}px`,
"--initial-height": e.expandByDefault ? "auto" : `${M.value}px`,
...R(H)
..._(H)
}),

@@ -373,4 +373,4 @@ onPointerdown: ue,

}, [
pe(Fe)
], 8, Ve)) : w("", !0),
pe(Le)
], 8, Fe)) : w("", !0),
$.value || s.toast.icon || s.toast.promise ? (u(), v("div", Ue, [

@@ -382,10 +382,10 @@ typeof s.toast.promise == "function" ? (u(), q(we, {

Z.value === "success" ? (u(), q(Ee, { key: 1 })) : w("", !0),
Z.value === "error" ? (u(), q(Re, { key: 2 })) : w("", !0)
Z.value === "error" ? (u(), q(_e, { key: 2 })) : w("", !0)
])) : w("", !0),
C("div", je, [
C("div", Ke, [
typeof s.toast.title == "string" ? (u(), v(L, { key: 0 }, [
te(A(s.toast.title), 1)
], 64)) : s.toast.title === void 0 || s.toast.title === null ? (u(), v(L, { key: 1 }, [
te(A(le.value), 1)
typeof s.toast.title == "string" ? (u(), v(V, { key: 0 }, [
te(R(s.toast.title), 1)
], 64)) : s.toast.title === void 0 || s.toast.title === null ? (u(), v(V, { key: 1 }, [
te(R(le.value), 1)
], 64)) : W.value ? (u(), q(me(s.toast.title), {

@@ -395,3 +395,3 @@ key: 2,

var r;
P(), (r = s.toast.cancel) != null && r.onClick && s.toast.cancel.onClick();
I(), (r = s.toast.cancel) != null && r.onClick && s.toast.cancel.onClick();
})

@@ -403,4 +403,4 @@ }, null, 32)) : w("", !0)

"data-description": "",
class: ee(s.descriptionClass + R(E))
}, A(s.toast.description), 3)) : w("", !0)
class: ee(s.descriptionClass + _(E))
}, R(s.toast.description), 3)) : w("", !0)
]),

@@ -413,5 +413,5 @@ s.toast.cancel ? (u(), v("button", {

var r;
P(), (r = s.toast.cancel) != null && r.onClick && s.toast.cancel.onClick();
I(), (r = s.toast.cancel) != null && r.onClick && s.toast.cancel.onClick();
})
}, A(s.toast.cancel.label), 1)) : w("", !0),
}, R(s.toast.cancel.label), 1)) : w("", !0),
s.toast.action ? (u(), v("button", {

@@ -422,9 +422,9 @@ key: 3,

var r;
P(), (r = s.toast.action) == null || r.onClick();
I(), (r = s.toast.action) == null || r.onClick();
})
}, A(s.toast.action.label), 1)) : w("", !0)
], 46, Le));
}, R(s.toast.action.label), 1)) : w("", !0)
], 46, Ve));
}
});
const Xe = ["aria-label"], Ze = ["data-theme", "data-rich-colors", "data-y-position", "data-x-position"], et = "32px", tt = 356, st = 14, ot = /* @__PURE__ */ J({
const Xe = ["aria-label"], Ze = ["data-theme", "data-rich-colors", "data-y-position", "data-x-position"], et = 3, tt = "32px", st = 356, ot = 14, nt = /* @__PURE__ */ J({
name: "Toaster",

@@ -440,4 +440,4 @@ inheritAttrs: !1,

expand: { type: Boolean, default: !1 },
duration: { default: Number },
visibleToasts: { default: 3 },
duration: {},
visibleToasts: { default: et },
closeButton: { type: Boolean, default: !1 },

@@ -447,6 +447,6 @@ toastOptions: { default: () => ({}) },

style: {},
offset: { default: 0 }
offset: {}
},
setup(s) {
const t = s, e = he(), o = c([]), h = c([]), y = c(!1), k = c(!1), I = f(() => t.position.split("-")), d = c(null), D = t.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
const t = s, e = he(), o = c([]), h = c([]), y = c(!1), k = c(!1), P = f(() => t.position.split("-")), d = c(null), S = t.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
function M(l) {

@@ -468,5 +468,5 @@ o.value = o.value.filter(({ id: i }) => i !== l.id);

});
}), S(() => {
}), D(() => {
o.value.length <= 1 && (y.value = !1);
}), S((l) => {
}), D((l) => {
function i(p) {

@@ -484,3 +484,3 @@ var $, N;

return u(), v("section", {
"aria-label": `Notifications ${R(D)}`,
"aria-label": `Notifications ${_(S)}`,
tabIndex: -1

@@ -495,11 +495,11 @@ }, [

"data-rich-colors": l.richColors,
"data-y-position": I.value[0],
"data-x-position": I.value[1],
"data-y-position": P.value[0],
"data-x-position": P.value[1],
style: G(
{
"--front-toast-height": `${(p = h.value[0]) == null ? void 0 : p.height}px`,
"--offset": typeof l.offset == "number" ? `${l.offset}px` : l.offset || et,
"--width": `${tt}px`,
"--gap": `${st}px`,
...R(e).style
"--offset": typeof l.offset == "number" ? `${l.offset}px` : l.offset || tt,
"--width": `${st}px`,
"--gap": `${ot}px`,
..._(e).style
}

@@ -515,3 +515,3 @@ ),

}, [
(u(!0), v(L, null, se(o.value, (T, $) => {
(u(!0), v(V, null, se(o.value, (T, $) => {
var N, E, H;

@@ -543,11 +543,11 @@ return u(), q(Qe, {

}
}), rt = {
}), ut = {
install(s) {
s.component("Toaster", ot);
s.component("Toaster", nt);
}
};
export {
ot as Toaster,
rt as default,
lt as toast
nt as Toaster,
ut as default,
rt as toast
};
{
"name": "vue-sonner",
"version": "0.4.2",
"version": "0.4.3",
"type": "module",

@@ -5,0 +5,0 @@ "author": "xiaoluoboding <xiaoluoboding@gmail.com>",

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