Socket
Socket
Sign inDemoInstall

@byloth/vuert

Package Overview
Dependencies
23
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.2.1-rc.1

197

dist/vuert.js

@@ -1,13 +0,5 @@

var T = Object.defineProperty;
var j = (t, e, i) => e in t ? T(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
var s = (t, e, i) => (j(t, typeof e != "symbol" ? e + "" : e, i), i);
import { getCurrentScope as C, inject as k, ref as A, computed as F, defineComponent as I, shallowRef as N, onMounted as V, onUnmounted as U, openBlock as $, createBlock as E, resolveDynamicComponent as D, withCtx as P, renderSlot as R, createCommentVNode as B, nextTick as H } from "vue";
import { RuntimeException as p, ValueException as v } from "@byloth/exceptions";
import { DeferredPromise as L, Subscribers as d, delay as g } from "@byloth/core";
const w = { $vuert: Symbol("[vuert]: vuert") }, b = class b {
constructor(e) {
s(this, "_subscribers");
s(this, "_options");
this._subscribers = [], this._options = { ...b.DEFAULT_OPTS, ...e };
}
import { getCurrentScope as x, inject as T, ref as C, computed as j, defineComponent as A, shallowRef as N, onMounted as V, onUnmounted as k, openBlock as F, createBlock as I, resolveDynamicComponent as U, withCtx as $, renderSlot as E, createCommentVNode as D, nextTick as P } from "vue";
import { RuntimeException as h, ValueException as f } from "@byloth/exceptions";
import { DeferredPromise as R, Subscribers as l, delay as _ } from "@byloth/core";
const w = { $vuert: Symbol("[vuert]: vuert") }, u = class u {
static get DEFAULT_OPTS() {

@@ -19,8 +11,11 @@ return { duration: 200 };

}
constructor(e) {
this._subscribers = [], this._options = { ...u.DEFAULT_OPTS, ...e };
}
emit(e) {
const o = this._subscribers.slice().map((l) => l(e)).filter((l) => !!l);
const o = this._subscribers.slice().map((c) => c(e)).filter((c) => !!c);
if (!o.length)
throw new p("Unable to handle the emitted alert properly. There wasn't found any supported subscribers.");
throw new h("Unable to handle the emitted alert properly. There wasn't found any supported subscribers.");
if (o.length > 1)
throw new p("Unable to handle the emitted alert properly. There were found too many supported subscribers.");
throw new h("Unable to handle the emitted alert properly. There were found too many supported subscribers.");
return o[0];

@@ -30,20 +25,20 @@ }

return this._subscribers.push(e), () => {
const i = this._subscribers.indexOf(e);
return this._subscribers.splice(i, 1)[0];
const r = this._subscribers.indexOf(e);
return this._subscribers.splice(r, 1)[0];
};
}
};
s(b, "VERSION", "1.2.0");
let m = b, S;
const K = (t) => {
S = t;
}, M = () => C() ? k(w.$vuert) : S, W = (t) => ({
install: ({ config: e, provide: i }) => {
const r = new m(t);
K(r), e.globalProperties.$vuert = r, i(w.$vuert, r);
u.VERSION = "1.2.1-rc.1";
let b = u, g;
const B = (t) => {
g = t;
}, H = () => x() ? T(w.$vuert) : g, z = (t) => ({
install: ({ config: e, provide: r }) => {
const n = new b(t);
B(n), e.globalProperties.$vuert = n, r(w.$vuert, n);
}
}), y = () => {
const t = M();
}), v = () => {
const t = H();
if (!t)
throw new p(
throw new h(
"`useVuert()` was called but there was not active Vuert. Did you forget to install `Vuert` plugin in your App?"

@@ -53,9 +48,4 @@ );

};
class O {
class y {
constructor(e) {
s(this, "id");
s(this, "type");
s(this, "icon");
s(this, "label");
s(this, "callback");
this.id = e.id ?? Symbol(), this.type = e.type ?? "secondary", this.icon = e.icon, this.label = e.label, this.callback = e.callback ?? (() => {

@@ -65,21 +55,10 @@ });

}
class u {
constructor(e, i) {
s(this, "id");
s(this, "type");
s(this, "priority");
s(this, "icon");
s(this, "title");
s(this, "message");
s(this, "component");
s(this, "props");
s(this, "actions");
s(this, "dismissible");
s(this, "timeout");
var r;
class a {
constructor(e, r) {
var n;
if (this.id = e.id ?? Symbol(), this.type = e.type ?? "info", this.priority = e.priority ?? "normal", this.icon = e.icon, this.title = e.title, e.message !== void 0 && e.component !== void 0)
throw new v("The `message` and `component` properties cannot both be valued at the same time.");
if (this.message = e.message, this.component = e.component, this.props = e.props, this.actions = ((r = e.actions) == null ? void 0 : r.map((o) => new O(o))) ?? [], this.dismissible = e.dismissible || !1, e.timeout !== void 0) {
throw new f("The `message` and `component` properties cannot both be valued at the same time.");
if (this.message = e.message, this.component = e.component, this.props = e.props, this.actions = ((n = e.actions) == null ? void 0 : n.map((o) => new y(o))) ?? [], this.dismissible = e.dismissible || !1, e.timeout !== void 0) {
if (e.timeout <= 0)
throw new v("The `timeout` property must be a positive integer or -at least- `undefined`.");
throw new f("The `timeout` property must be a positive integer or -at least- `undefined`.");
this.timeout = e.timeout;

@@ -90,22 +69,12 @@ } else

}
class q extends L {
constructor(i, r) {
const o = async () => {
class L extends R {
constructor(e, r) {
const n = async () => {
if (!this._isOpen.value)
throw new Error("Unable to close the alert. It has already been closed or not even opened yet.");
this._isOpen.value = !1, this._timeoutId !== void 0 && (clearTimeout(this._timeoutId), this._timeoutId = void 0), this._closingSubscribers.call(), await g(this._duration.leave), this._closedSubscribers.call();
this._isOpen.value = !1, this._timeoutId !== void 0 && (clearTimeout(this._timeoutId), this._timeoutId = void 0), this._closingSubscribers.call(), await _(this._duration.leave), this._closedSubscribers.call();
}, o = (i) => (n(), i instanceof y ? i.callback() : i instanceof Function ? i() : i), c = (i) => {
throw n(), i;
};
super((c) => (o(), c instanceof O ? c.callback() : c instanceof Function ? c() : c), (c) => {
throw o(), c;
});
s(this, "_duration");
s(this, "_timeoutId");
s(this, "_openingSubscribers");
s(this, "_openedSubscribers");
s(this, "_closingSubscribers");
s(this, "_closedSubscribers");
s(this, "_isOpen");
s(this, "alert");
s(this, "isOpen");
if (typeof r == "object")
if (super(o, c), typeof r == "object")
this._duration = {

@@ -116,9 +85,9 @@ enter: Number(r.enter),

else {
const c = Number(r);
const i = Number(r);
this._duration = {
enter: c,
leave: c
enter: i,
leave: i
};
}
this._openingSubscribers = new d(), this._openedSubscribers = new d(), this._closingSubscribers = new d(), this._closedSubscribers = new d(), this.alert = new u(i), this._isOpen = A(!1), this.isOpen = F(() => this._isOpen.value);
this._openingSubscribers = new l(), this._openedSubscribers = new l(), this._closingSubscribers = new l(), this._closedSubscribers = new l(), this.alert = new a(e), this._isOpen = C(!1), this.isOpen = j(() => this._isOpen.value);
}

@@ -128,18 +97,18 @@ async open() {

throw new Error("Unable to open the alert. It has already been opened.");
this._isOpen.value = !0, this._openingSubscribers.call(), await g(this._duration.enter), this._openedSubscribers.call(), this.alert.timeout && (this._timeoutId = setTimeout(this.resolve, this.alert.timeout));
this._isOpen.value = !0, this._openingSubscribers.call(), await _(this._duration.enter), this._openedSubscribers.call(), this.alert.timeout && (this._timeoutId = setTimeout(this.resolve, this.alert.timeout));
}
onOpening(i) {
this._openingSubscribers.add(i);
onOpening(e) {
this._openingSubscribers.add(e);
}
onOpened(i) {
this._openedSubscribers.add(i);
onOpened(e) {
this._openedSubscribers.add(e);
}
onClosing(i) {
this._closingSubscribers.add(i);
onClosing(e) {
this._closingSubscribers.add(e);
}
onClosed(i) {
this._closedSubscribers.add(i);
onClosed(e) {
this._closedSubscribers.add(e);
}
}
const X = /* @__PURE__ */ I({
const G = /* @__PURE__ */ A({
__name: "AlertHandler",

@@ -152,3 +121,3 @@ props: {

duration: {
default: () => y().options.duration,
default: () => v().options.duration,
type: [Number, Object],

@@ -163,32 +132,32 @@ validator: (t) => t instanceof Object ? "enter" in t && "leave" in t ? isFinite(Number(t.enter)) && isFinite(Number(t.leave)) : !1 : isFinite(Number(t))

emits: {
opening: (t) => t instanceof u,
opened: (t) => t instanceof u,
closing: (t) => t instanceof u,
closed: (t) => t instanceof u
opening: (t) => t instanceof a,
opened: (t) => t instanceof a,
closing: (t) => t instanceof a,
closed: (t) => t instanceof a
},
setup(t, { emit: e }) {
const i = y(), r = t, o = e, l = [], a = N(), c = () => new Promise((n) => H(n)), f = async () => {
const n = l[0];
n.onOpening(() => o("opening", n.alert)), n.onOpened(() => o("opened", n.alert)), n.onClosing(() => o("closing", n.alert)), n.onClosed(async () => {
o("closed", n.alert), l.shift(), a.value = void 0, await c(), l.length > 0 && f();
}), a.value = n, await n.open();
}, x = (n) => {
const h = new q(n, r.duration);
return l.push(h), l.length === 1 && f(), h;
const r = v(), n = t, o = e, c = [], i = N(), S = () => new Promise((s) => P(s)), p = async () => {
const s = c[0];
s.onOpening(() => o("opening", s.alert)), s.onOpened(() => o("opened", s.alert)), s.onClosing(() => o("closing", s.alert)), s.onClosed(async () => {
o("closed", s.alert), c.shift(), i.value = void 0, await S(), c.length > 0 && p();
}), i.value = s, await s.open();
}, O = (s) => {
const d = new L(s, n.duration);
return c.push(d), c.length === 1 && p(), d;
};
let _;
let m;
return V(() => {
_ = i.subscribe((n) => {
if (r.filter(n))
return x(n);
m = r.subscribe((s) => {
if (n.filter(s))
return O(s);
});
}), U(() => _()), (n, h) => ($(), E(D(t.is), null, {
default: P(() => [
a.value ? R(n.$slots, "default", {
}), k(() => m()), (s, d) => (F(), I(U(t.is), null, {
default: $(() => [
i.value ? E(s.$slots, "default", {
key: 0,
alert: a.value.alert,
isOpen: a.value.isOpen.value,
resolve: a.value.resolve,
reject: a.value.reject
}) : B("", !0)
alert: i.value.alert,
isOpen: i.value.isOpen.value,
resolve: i.value.resolve,
reject: i.value.reject
}) : D("", !0)
]),

@@ -200,10 +169,10 @@ _: 3

export {
O as Action,
u as Alert,
X as AlertHandler,
q as Context,
W as createVuert,
m as default,
y as useVuert
y as Action,
a as Alert,
G as AlertHandler,
L as Context,
z as createVuert,
b as default,
v as useVuert
};
//# sourceMappingURL=vuert.js.map
{
"name": "@byloth/vuert",
"version": "1.2.0",
"version": "1.2.1-rc.1",
"description": "The headless alerts, notifications & popups library for Vue.js craftsmen. ℹ",

@@ -12,2 +12,3 @@ "keywords": [

"Vue.js",
"Nuxt.js",
"JavaScript",

@@ -40,10 +41,5 @@ "TypeScript",

".": {
"import": {
"default": "./dist/vuert.js",
"types": "./src/index.ts"
},
"require": {
"default": "./dist/vuert.umd.cjs",
"types": "./src/index.ts"
}
"import": "./dist/vuert.js",
"require": "./dist/vuert.umd.cjs",
"types": "./src/index.ts"
}

@@ -53,17 +49,13 @@ },

"scripts": {
"dev": "vitepress dev docs",
"build": "yarn build:core && yarn build:docs",
"build:core": "vite build",
"build:docs": "vitepress build docs",
"build:types": "vue-tsc --emitDeclarationOnly",
"preview": "vitepress serve docs",
"build": "vite build",
"build:types": "vue-tsc --build --emitDeclarationOnly --force",
"check:types": "vue-tsc --noEmit",
"lint": "eslint --ext .cjs,.js,.json,.ts,.vue --ignore-path .gitignore .",
"lint:prod": "export NODE_ENV=\"production\" && yarn lint",
"ci": "yarn install --frozen-lockfile"
"lint:prod": "NODE_ENV=\"production\" yarn lint",
"publish": "npm publish --access public"
},
"dependencies": {
"@byloth/core": "^1.2.0",
"@byloth/exceptions": "^2.2.0",
"vue": "^3.4.5"
"@byloth/core": "^1.3.0-rc.2",
"@byloth/exceptions": "^2.2.2",
"vue": "^3.4.15"
},

@@ -73,15 +65,13 @@ "devDependencies": {

"@byloth/eslint-config-vue": "^2.6.8",
"@fortawesome/fontawesome-free": "^6.5.1",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"@vitejs/plugin-vue": "^5.0.2",
"@types/node": "^20.11.16",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitejs/plugin-vue": "^5.0.3",
"eslint": "^8.56.0",
"eslint-plugin-vue": "^9.19.2",
"sass": "^1.69.7",
"eslint-plugin-vue": "^9.21.1",
"typescript": "^5.3.3",
"vite": "^5.0.11",
"vitepress": "^1.0.0-rc.36",
"vue-eslint-parser": "^9.3.2",
"vite": "^5.0.12",
"vue-eslint-parser": "^9.4.2",
"vue-tsc": "^1.8.27"
}
}

@@ -24,3 +24,3 @@ import type { Component, PropType } from "vue";

closed: (alert: Alert<unknown>) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
is: {

@@ -46,4 +46,4 @@ default: string;

filter: (options: AlertOptions<unknown>) => boolean;
duration: number | Duration;
is: string | Component;
duration: number | Duration;
}, {}>, {

@@ -50,0 +50,0 @@ default?(_: {

@@ -5,3 +5,3 @@ import { computed, ref } from "vue";

import { delay, DeferredPromise, Subscribers } from "@byloth/core";
import type { MaybePromise } from "@byloth/core";
import type { MaybePromise, Timeout } from "@byloth/core";

@@ -20,3 +20,3 @@ import type { Duration } from "../types/index.js";

protected _duration: Duration;
protected _timeoutId?: number;
protected _timeoutId?: Timeout;

@@ -23,0 +23,0 @@ protected _openingSubscribers: Subscribers;

@@ -20,3 +20,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

{
public static readonly VERSION: string = "1.2.0";
public static readonly VERSION: string = "1.2.1-rc.1";

@@ -23,0 +23,0 @@ public static get DEFAULT_OPTS(): VuertOptions

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc