Socket
Socket
Sign inDemoInstall

@blumjs/router

Package Overview
Dependencies
2
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.7 to 1.0.8

468

dist/index.js

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

import T, { useEffect as ke, useState as yt } from "react";
import T, { useEffect as ke } from "react";
function wt(e, t) {

@@ -13,31 +13,31 @@ for (let n in e)

}
function N({ node: e = [], from: t, source: n, parent: r = t || n, to: a, target: s, child: o = a || s, scope: v = {}, meta: _ = {}, family: p = { type: "regular" }, regional: S } = {}) {
let f = ue(r), d = ue(p.links), i = ue(p.owners), u = [];
k(e, (c) => c && V(u, c));
let l = { id: Vt(), seq: u, next: ue(o), meta: _, scope: v, family: { type: p.type || "crosslink", links: d, owners: i } };
return k(d, (c) => V(me(c), l)), k(i, (c) => V(ve(c), l)), k(f, (c) => V(c.next, l)), S && P && ze(X(P), [l]), l;
function N({ node: e = [], from: t, source: n, parent: r = t || n, to: a, target: u, child: o = a || u, scope: m = {}, meta: _ = {}, family: d = { type: "regular" }, regional: S } = {}) {
let f = ue(r), p = ue(d.links), i = ue(d.owners), s = [];
k(e, (c) => c && V(s, c));
let l = { id: Vt(), seq: s, next: ue(o), meta: _, scope: m, family: { type: d.type || "crosslink", links: p, owners: i } };
return k(p, (c) => V(me(c), l)), k(i, (c) => V(ve(c), l)), k(f, (c) => V(c.next, l)), S && P && ze(X(P), [l]), l;
}
function ee(e, t, n) {
let r, a = M, s = null, o = O;
if (e.target && (t = e.params, n = e.defer, r = e.meta, a = "page" in e ? e.page : a, e.stack && (s = e.stack), o = I(e) || o, e = e.target), o && O && o !== O && (O = null), Array.isArray(e))
for (let u = 0; u < e.length; u++)
B("pure", a, C(e[u]), s, t[u], o, r);
let r, a = M, u = null, o = O;
if (e.target && (t = e.params, n = e.defer, r = e.meta, a = "page" in e ? e.page : a, e.stack && (u = e.stack), o = I(e) || o, e = e.target), o && O && o !== O && (O = null), Array.isArray(e))
for (let s = 0; s < e.length; s++)
B("pure", a, C(e[s]), u, t[s], o, r);
else
B("pure", a, C(e), s, t, o, r);
B("pure", a, C(e), u, t, o, r);
if (n && !se)
return;
let v, _, p, S, f, d, i = { isRoot: se, currentPage: M, scope: O, isWatch: fe, isPure: ce };
let m, _, d, S, f, p, i = { isRoot: se, currentPage: M, scope: O, isWatch: fe, isPure: ce };
se = 0;
e:
for (; S = Wt(); ) {
let { idx: u, stack: l, type: c } = S;
p = l.node, M = f = l.page, O = I(l), f ? d = f.reg : O && (d = O.reg);
let b = !!f, L = !!O, w = { fail: 0, scope: p.scope };
v = _ = 0;
for (let m = u; m < p.seq.length && !v; m++) {
let y = p.seq[m];
let { idx: s, stack: l, type: c } = S;
d = l.node, M = f = l.page, O = I(l), f ? p = f.reg : O && (p = O.reg);
let b = !!f, R = !!O, w = { fail: 0, scope: d.scope };
m = _ = 0;
for (let v = s; v < d.seq.length && !m; v++) {
let y = d.seq[v];
if (y.order) {
let { priority: h, barrierID: g } = y.order, E = g ? f ? `${f.fullID}_${g}` : g : 0;
if (m !== u || c !== h) {
g ? Oe.has(E) || (Oe.add(E), De(m, l, h, g)) : De(m, l, h);
if (v !== s || c !== h) {
g ? Oe.has(E) || (Oe.add(E), De(v, l, h, g)) : De(v, l, h);
continue e;

@@ -62,9 +62,9 @@ }

case "store":
if (d && !d[E.store.id])
if (p && !p[E.store.id])
if (b) {
let R = lt(f, E.store.id);
l.page = f = R, R ? d = R.reg : L ? (F(O, E.store, 0, 1, E.softRead), d = O.reg) : d = void 0;
let L = lt(f, E.store.id);
l.page = f = L, L ? p = L.reg : R ? (F(O, E.store, 0, 1, E.softRead), p = O.reg) : p = void 0;
} else
L && F(O, E.store, 0, 1, E.softRead);
g = st(d && d[E.store.id] || E.store);
R && F(O, E.store, 0, 1, E.softRead);
g = st(p && p[E.store.id] || E.store);
}

@@ -80,3 +80,3 @@ switch (E.to) {

case "store":
Pt(f, O, p, E.target).current = g;
Pt(f, O, d, E.target).current = g;
}

@@ -88,3 +88,3 @@ break;

if (h.fn) {
fe = x(p, "op") === "watch", ce = h.pure;
fe = x(d, "op") === "watch", ce = h.pure;
let g = h.safe ? (0, h.fn)(X(l), w.scope, l) : Ft(w, h.fn, l);

@@ -94,13 +94,13 @@ h.filter ? _ = !g : l.value = g, fe = i.isWatch, ce = i.isPure;

}
v = w.fail || _;
m = w.fail || _;
}
if (!v) {
let m = X(l), y = I(l);
if (k(p.next, (h) => {
B("child", f, h, l, m, y);
if (!m) {
let v = X(l), y = I(l);
if (k(d.next, (h) => {
B("child", f, h, l, v, y);
}), y) {
x(p, "needFxCounter") && B("child", f, y.fxCount, l, m, y), x(p, "storeChange") && B("child", f, y.storeChange, l, m, y), x(p, "warnSerialize") && B("child", f, y.warnSerializeNode, l, m, y);
let h = y.additionalLinks[p.id];
x(d, "needFxCounter") && B("child", f, y.fxCount, l, v, y), x(d, "storeChange") && B("child", f, y.storeChange, l, v, y), x(d, "warnSerialize") && B("child", f, y.warnSerializeNode, l, v, y);
let h = y.additionalLinks[d.id];
h && k(h, (g) => {
B("child", f, g, l, m, y);
B("child", f, g, l, v, y);
});

@@ -115,4 +115,4 @@ }

if (t) {
let s = Rt(t);
e.length === 0 ? (n = s.path, r = s.fullName) : (n = s.path.concat([e]), r = s.fullName.length === 0 ? e : s.fullName + "/" + e);
let u = Lt(t);
e.length === 0 ? (n = u.path, r = u.fullName) : (n = u.path.concat([e]), r = u.fullName.length === 0 ? e : u.fullName + "/" + e);
} else

@@ -131,15 +131,15 @@ n = e.length === 0 ? [] : [e], r = e;

function A(e, t) {
let n = K({ or: t, and: typeof e == "string" ? { name: e } : e }), r = (o, ...v) => (ne(!x(r, "derived"), "call of derived event", "createEvent"), ne(!ce, "unit call from pure function", "operators like sample"), M ? ((_, p, S, f) => {
let d = M, i = null;
if (p)
for (i = M; i && i.template !== p; )
let n = K({ or: t, and: typeof e == "string" ? { name: e } : e }), r = (o, ...m) => (ne(!x(r, "derived"), "call of derived event", "createEvent"), ne(!ce, "unit call from pure function", "operators like sample"), M ? ((_, d, S, f) => {
let p = M, i = null;
if (d)
for (i = M; i && i.template !== d; )
i = z(i);
Je(i);
let u = _.create(S, f);
return Je(d), u;
})(r, a, o, v) : r.create(o, v)), a = it(), s = Object.assign(r, { graphite: N({ meta: dt("event", r, n), regional: 1 }), create: (o) => (ee({ target: r, params: o, scope: O }), o), watch: (o) => ct(r, o), map: (o) => be(r, te, o, [W()]), filter: (o) => be(r, "filter", o.fn ? o : o.fn, [W(je, 1)]), filterMap: (o) => be(r, "filterMap", o, [W(), H((v) => !q(v), 1)]), prepend(o) {
let v = A("* → " + r.shortName, { parent: z(r) });
return Q("eventPrepend", C(v)), Pe(v, r, [W()], "prepend", o), Kt(r, v), v;
let s = _.create(S, f);
return Je(p), s;
})(r, a, o, m) : r.create(o, m)), a = it(), u = Object.assign(r, { graphite: N({ meta: dt("event", r, n), regional: 1 }), create: (o) => (ee({ target: r, params: o, scope: O }), o), watch: (o) => ct(r, o), map: (o) => be(r, te, o, [W()]), filter: (o) => be(r, "filter", o.fn ? o : o.fn, [W(je, 1)]), filterMap: (o) => be(r, "filterMap", o, [W(), H((m) => !q(m), 1)]), prepend(o) {
let m = A("* → " + r.shortName, { parent: z(r) });
return Q("eventPrepend", C(m)), Pe(m, r, [W()], "prepend", o), Kt(r, m), m;
} });
return n != null && n.domain && n.domain.hooks.event(s), s;
return n != null && n.domain && n.domain.hooks.event(u), u;
}

@@ -154,31 +154,31 @@ function He(e, t, n, r) {

Q("storeBase", r);
let s = r.id, o = { subscribers: /* @__PURE__ */ new Map(), updates: a, defaultState: e, stateRef: r, getState() {
let u, l = r;
let u = r.id, o = { subscribers: /* @__PURE__ */ new Map(), updates: a, defaultState: e, stateRef: r, getState() {
let s, l = r;
if (M) {
let c = M;
for (; c && !c.reg[s]; )
for (; c && !c.reg[u]; )
c = z(c);
c && (u = c);
c && (s = c);
}
return !u && O && (F(O, r, 1), u = O), u && (l = u.reg[s]), st(l);
}, setState: (u) => ee({ target: o, params: u, defer: 1, scope: O }), reset: (...u) => (k(u, (l) => He(o, ".reset", l, () => o.defaultState)), o), on: (u, l) => He(o, ".on", u, l), off(u) {
let l = pe(o).get(u);
return l && (l(), pe(o).delete(u)), o;
}, map(u, l) {
return !s && O && (F(O, r, 1), s = O), s && (l = s.reg[u]), st(l);
}, setState: (s) => ee({ target: o, params: s, defer: 1, scope: O }), reset: (...s) => (k(s, (l) => He(o, ".reset", l, () => o.defaultState)), o), on: (s, l) => He(o, ".on", s, l), off(s) {
let l = pe(o).get(s);
return l && (l(), pe(o).delete(s)), o;
}, map(s, l) {
let c, b;
j(u) && (c = u, u = u.fn), ne(q(l), "second argument of store.map", "updateFilter");
let L = o.getState();
q(L) || (b = u(L, l));
let w = $e(b, { name: `${o.shortName} → *`, derived: 1, and: c }), m = pt(o, w, te, Ue, u);
return qt(de(w), { type: te, fn: u, from: r }), de(w).noInit = 1, Q("storeMap", r, m), w;
}, watch(u, l) {
if (!l || !Ne(u)) {
let c = ct(o, u);
return Q("storeWatch", r, u) || u(o.getState()), c;
j(s) && (c = s, s = s.fn), ne(q(l), "second argument of store.map", "updateFilter");
let R = o.getState();
q(R) || (b = s(R, l));
let w = $e(b, { name: `${o.shortName} → *`, derived: 1, and: c }), v = pt(o, w, te, Ue, s);
return qt(de(w), { type: te, fn: s, from: r }), de(w).noInit = 1, Q("storeMap", r, v), w;
}, watch(s, l) {
if (!l || !Ne(s)) {
let c = ct(o, s);
return Q("storeWatch", r, s) || s(o.getState()), c;
}
return $(D(l), "second argument should be a function"), u.watch((c) => l(o.getState(), c));
} }, v = dt("store", o, n), _ = o.defaultConfig.updateFilter;
o.graphite = N({ scope: { state: r, fn: _ }, node: [H((u, l, c) => (c.scope && !c.scope.reg[r.id] && (c.b = 1), u)), Bt(r), H((u, l, { a: c, b }) => !q(u) && (u !== c || b), 1), _ && W(Ue, 1), Se({ from: re, target: r })], child: a, meta: v, regional: 1 });
let p = x(o, "serialize"), S = x(o, "derived"), f = p === "ignore", d = !p || f ? 0 : p, i = x(o, "sid");
return i && (f || Z(o, "storeChange", 1), r.sid = i, d && (r.meta = { ...r == null ? void 0 : r.meta, serialize: d })), i || f || S || Z(o, "warnSerialize", 1), $(S || !q(e), "current state can't be undefined, use null instead"), ze(o, [a]), n != null && n.domain && n.domain.hooks.store(o), S || (o.reinit = A(), o.reset(o.reinit)), o;
return $(D(l), "second argument should be a function"), s.watch((c) => l(o.getState(), c));
} }, m = dt("store", o, n), _ = o.defaultConfig.updateFilter;
o.graphite = N({ scope: { state: r, fn: _ }, node: [H((s, l, c) => (c.scope && !c.scope.reg[r.id] && (c.b = 1), s)), Bt(r), H((s, l, { a: c, b }) => !q(s) && (s !== c || b), 1), _ && W(Ue, 1), Se({ from: re, target: r })], child: a, meta: m, regional: 1 });
let d = x(o, "serialize"), S = x(o, "derived"), f = d === "ignore", p = !d || f ? 0 : d, i = x(o, "sid");
return i && (f || Z(o, "storeChange", 1), r.sid = i, p && (r.meta = { ...r == null ? void 0 : r.meta, serialize: p })), i || f || S || Z(o, "warnSerialize", 1), $(S || !q(e), "current state can't be undefined, use null instead"), ze(o, [a]), n != null && n.domain && n.domain.hooks.store(o), S || (o.reinit = A(), o.reset(o.reinit)), o;
}

@@ -195,29 +195,29 @@ function Ot() {

Z(a, "op", r.kind = "effect"), r.use = (i) => ($(D(i), ".use argument should be a function"), S.scope.handler = i, r), r.use.getCurrent = () => S.scope.handler;
let s = r.finally = A({ named: "finally", derived: 1 }), o = r.done = s.filterMap({ named: "done", fn({ status: i, params: u, result: l }) {
let u = r.finally = A({ named: "finally", derived: 1 }), o = r.done = u.filterMap({ named: "done", fn({ status: i, params: s, result: l }) {
if (i === "done")
return { params: u, result: l };
} }), v = r.fail = s.filterMap({ named: "fail", fn({ status: i, params: u, error: l }) {
return { params: s, result: l };
} }), m = r.fail = u.filterMap({ named: "fail", fn({ status: i, params: s, error: l }) {
if (i === "fail")
return { params: u, error: l };
} }), _ = r.doneData = o.map({ named: "doneData", fn: ({ result: i }) => i }), p = r.failData = v.map({ named: "failData", fn: ({ error: i }) => i }), S = N({ scope: { handlerId: x(a, "sid"), handler: r.defaultConfig.handler || (() => $(0, `no handler used in ${r.getType()}`)) }, node: [H((i, u, l) => {
let c = u, b = c.handler;
return { params: s, error: l };
} }), _ = r.doneData = o.map({ named: "doneData", fn: ({ result: i }) => i }), d = r.failData = m.map({ named: "failData", fn: ({ error: i }) => i }), S = N({ scope: { handlerId: x(a, "sid"), handler: r.defaultConfig.handler || (() => $(0, `no handler used in ${r.getType()}`)) }, node: [H((i, s, l) => {
let c = s, b = c.handler;
if (I(l)) {
let L = I(l).handlers[c.handlerId];
L && (b = L);
let R = I(l).handlers[c.handlerId];
R && (b = R);
}
return i.handler = b, i;
}, 0, 1), H(({ params: i, req: u, handler: l, args: c = [i] }, b, L) => {
let w = Yt(L), m = Xe(i, u, 1, s, L, w), y = Xe(i, u, 0, s, L, w), [h, g] = Ut(l, y, c);
h && (j(g) && D(g.then) ? g.then(m, y) : m(g));
}, 0, 1), H(({ params: i, req: s, handler: l, args: c = [i] }, b, R) => {
let w = Yt(R), v = Xe(i, s, 1, u, R, w), y = Xe(i, s, 0, u, R, w), [h, g] = Ut(l, y, c);
h && (j(g) && D(g.then) ? g.then(v, y) : v(g));
}, 0, 1)], meta: { op: "fx", fx: "runner" } });
a.scope.runner = S, V(a.seq, H((i, { runner: u }, l) => {
a.scope.runner = S, V(a.seq, H((i, { runner: s }, l) => {
let c = z(l) ? { params: i, req: { rs(b) {
}, rj(b) {
} } } : i;
return l.meta || (l.meta = { fxID: Mt() }), ee({ target: u, params: c, defer: 1, scope: I(l), meta: l.meta }), c.params;
return l.meta || (l.meta = { fxID: Mt() }), ee({ target: s, params: c, defer: 1, scope: I(l), meta: l.meta }), c.params;
}, 0, 1)), r.create = (i) => {
let u = Ot(), l = { params: i, req: u };
let s = Ot(), l = { params: i, req: s };
if (O && !fe) {
let c = O;
u.req.finally(() => {
s.req.finally(() => {
Gt(c);

@@ -227,10 +227,10 @@ }).catch(() => {

}
return ee({ target: r, params: l, scope: O }), u.req;
return ee({ target: r, params: l, scope: O }), s.req;
};
let f = r.inFlight = $e(0, { serialize: "ignore" }).on(r, (i) => i + 1).on(s, (i) => i - 1).map({ fn: (i) => i, named: "inFlight" });
Z(s, "needFxCounter", "dec"), Z(r, "needFxCounter", 1);
let d = r.pending = f.map({ fn: (i) => i > 0, named: "pending" });
return ze(r, [s, o, v, _, p, d, f]), n != null && n.domain && n.domain.hooks.effect(r), r;
let f = r.inFlight = $e(0, { serialize: "ignore" }).on(r, (i) => i + 1).on(u, (i) => i - 1).map({ fn: (i) => i, named: "inFlight" });
Z(u, "needFxCounter", "dec"), Z(r, "needFxCounter", 1);
let p = r.pending = f.map({ fn: (i) => i > 0, named: "pending" });
return ze(r, [u, o, m, _, d, p, f]), n != null && n.domain && n.domain.hooks.effect(r), r;
}
let Lt = typeof Symbol < "u" && Symbol.observable || "@@observable", te = "map", re = "stack", C = (e) => e.graphite || e, me = (e) => e.family.owners, ve = (e) => e.family.links, de = (e) => e.stateRef, X = (e) => e.value, pe = (e) => e.subscribers, z = (e) => e.parent, I = (e) => e.scope, x = (e, t) => C(e).meta[t], Z = (e, t, n) => C(e).meta[t] = n, Rt = (e) => e.compositeName, Ne = (e) => (D(e) || j(e)) && "kind" in e;
let Rt = typeof Symbol < "u" && Symbol.observable || "@@observable", te = "map", re = "stack", C = (e) => e.graphite || e, me = (e) => e.family.owners, ve = (e) => e.family.links, de = (e) => e.stateRef, X = (e) => e.value, pe = (e) => e.subscribers, z = (e) => e.parent, I = (e) => e.scope, x = (e, t) => C(e).meta[t], Z = (e, t, n) => C(e).meta[t] = n, Lt = (e) => e.compositeName, Ne = (e) => (D(e) || j(e)) && "kind" in e;
const ie = (e) => (t) => Ne(t) && t.kind === e;

@@ -262,3 +262,3 @@ let Be = ie("store"), xt = ie("event"), Fe = ie("effect"), ot = ie("domain"), At = ie("scope");

};
let Nt = 0, Se = ({ from: e = "store", store: t, target: n, to: r = n ? "store" : re, batch: a, priority: s }) => ut("mov", { from: e, store: t, to: r, target: n }, s, a), oe = ({ fn: e, batch: t, priority: n, safe: r = 0, filter: a = 0, pure: s = 0 }) => ut("compute", { fn: e, safe: r, filter: a, pure: s }, n, t), qe = ({ fn: e }) => oe({ fn: e, priority: "effect" }), H = (e, t, n) => oe({ fn: e, safe: 1, filter: t, priority: n && "effect" }), Bt = (e, t, n) => Se({ store: e, to: t ? re : "a", priority: n && "sampler", batch: 1 }), W = (e = je, t) => oe({ fn: e, pure: 1, filter: t }), zt = { mov: Se, compute: oe, filter: ({ fn: e, pure: t }) => oe({ fn: e, filter: 1, pure: t }), run: qe }, jt = (e) => ({ id: at(), current: e }), st = ({ current: e }) => e, qt = (e, t) => {
let Nt = 0, Se = ({ from: e = "store", store: t, target: n, to: r = n ? "store" : re, batch: a, priority: u }) => ut("mov", { from: e, store: t, to: r, target: n }, u, a), oe = ({ fn: e, batch: t, priority: n, safe: r = 0, filter: a = 0, pure: u = 0 }) => ut("compute", { fn: e, safe: r, filter: a, pure: u }, n, t), qe = ({ fn: e }) => oe({ fn: e, priority: "effect" }), H = (e, t, n) => oe({ fn: e, safe: 1, filter: t, priority: n && "effect" }), Bt = (e, t, n) => Se({ store: e, to: t ? re : "a", priority: n && "sampler", batch: 1 }), W = (e = je, t) => oe({ fn: e, pure: 1, filter: t }), zt = { mov: Se, compute: oe, filter: ({ fn: e, pure: t }) => oe({ fn: e, filter: 1, pure: t }), run: qe }, jt = (e) => ({ id: at(), current: e }), st = ({ current: e }) => e, qt = (e, t) => {
e.before || (e.before = []), V(e.before, t);

@@ -291,5 +291,5 @@ }, G = null;

}
}, B = (e, t, n, r, a, s, o) => De(0, { a: null, b: null, node: n, parent: r, value: a, page: t, scope: s, meta: o }, e), De = (e, t, n, r = 0) => {
let a = Ve(n), s = Ge[a], o = { v: { idx: e, stack: t, type: n, id: r }, l: null, r: null };
a === 3 || a === 4 ? G = We(G, o) : (s.size === 0 ? s.first = o : s.last.r = o, s.last = o), s.size += 1;
}, B = (e, t, n, r, a, u, o) => De(0, { a: null, b: null, node: n, parent: r, value: a, page: t, scope: u, meta: o }, e), De = (e, t, n, r = 0) => {
let a = Ve(n), u = Ge[a], o = { v: { idx: e, stack: t, type: n, id: r }, l: null, r: null };
a === 3 || a === 4 ? G = We(G, o) : (u.size === 0 ? u.first = o : u.last.r = o, u.last = o), u.size += 1;
}, Ve = (e) => {

@@ -328,24 +328,24 @@ switch (e) {

let Pt = (e, t, n, r, a) => {
let s = lt(e, r.id);
return s ? s.reg[r.id] : t ? (F(t, r, a), t.reg[r.id]) : r;
let u = lt(e, r.id);
return u ? u.reg[r.id] : t ? (F(t, r, a), t.reg[r.id]) : r;
};
const Ht = (e) => e;
let F = (e, t, n, r, a) => {
var s;
let o = e.reg, v = t.sid, _ = t == null || (s = t.meta) === null || s === void 0 ? void 0 : s.serialize;
var u;
let o = e.reg, m = t.sid, _ = t == null || (u = t.meta) === null || u === void 0 ? void 0 : u.serialize;
if (o[t.id])
return;
let p = { id: t.id, current: t.current, meta: t.meta };
if (v && v in e.sidValuesMap && !(v in e.sidIdMap))
p.current = (e.fromSerialize && _ !== "ignore" && (_ == null ? void 0 : _.read) || Ht)(e.sidValuesMap[v]);
let d = { id: t.id, current: t.current, meta: t.meta };
if (m && m in e.sidValuesMap && !(m in e.sidIdMap))
d.current = (e.fromSerialize && _ !== "ignore" && (_ == null ? void 0 : _.read) || Ht)(e.sidValuesMap[m]);
else if (t.before && !a) {
let S = 0, f = n || !t.noInit || r;
k(t.before, (d) => {
switch (d.type) {
k(t.before, (p) => {
switch (p.type) {
case te: {
let i = d.from;
if (i || d.fn) {
let i = p.from;
if (i || p.fn) {
i && F(e, i, n, r);
let u = i && o[i.id].current;
f && (p.current = d.fn ? d.fn(u) : u);
let s = i && o[i.id].current;
f && (d.current = p.fn ? p.fn(s) : s);
}

@@ -355,7 +355,7 @@ break;

case "field":
S || (S = 1, p.current = Array.isArray(p.current) ? [...p.current] : { ...p.current }), F(e, d.from, n, r), f && (p.current[d.field] = o[o[d.from.id].id].current);
S || (S = 1, d.current = Array.isArray(d.current) ? [...d.current] : { ...d.current }), F(e, p.from, n, r), f && (d.current[p.field] = o[o[p.from.id].id].current);
}
});
}
v && (e.sidIdMap[v] = t.id), o[t.id] = p;
m && (e.sidIdMap[m] = t.id), o[t.id] = d;
};

@@ -399,4 +399,4 @@ const Ft = (e, t, n) => {

}, dt = (e, t, n) => {
let r = K(n), a = e === "domain", s = Dt(), { sid: o = null, named: v = null, domain: _ = null, parent: p = _ } = r, S = v || r.name || (a ? "" : s), f = Et(S, p), d = { op: t.kind = e, name: t.shortName = S, sid: t.sid = Tt(o), named: v, unitId: t.id = s, serialize: r.serialize, derived: r.derived, config: r };
return t.parent = p, t.compositeName = f, t.defaultConfig = r, t.thru = (i) => (ne(0, "thru", "js pipe"), i(t)), t.getType = () => f.fullName, !a && (t.subscribe = (i) => (Ct(i), t.watch(D(i) ? i : (u) => i.next && i.next(u))), t[Lt] = () => t), d;
let r = K(n), a = e === "domain", u = Dt(), { sid: o = null, named: m = null, domain: _ = null, parent: d = _ } = r, S = m || r.name || (a ? "" : u), f = Et(S, d), p = { op: t.kind = e, name: t.shortName = S, sid: t.sid = Tt(o), named: m, unitId: t.id = u, serialize: r.serialize, derived: r.derived, config: r };
return t.parent = d, t.compositeName = f, t.defaultConfig = r, t.thru = (i) => (ne(0, "thru", "js pipe"), i(t)), t.getType = () => f.fullName, !a && (t.subscribe = (i) => (Ct(i), t.watch(D(i) ? i : (s) => i.next && i.next(s))), t[Rt] = () => t), p;
};

@@ -406,9 +406,9 @@ const be = (e, t, n, r) => {

j(n) && (a = n, n = n.fn);
let s = A({ name: `${e.shortName} → *`, derived: 1, and: a });
return Pe(e, s, r, t, n), s;
let u = A({ name: `${e.shortName} → *`, derived: 1, and: a });
return Pe(e, u, r, t, n), u;
}, pt = (e, t, n, r, a) => {
let s = de(t), o = Se({ store: s, to: "a", priority: "read" });
let u = de(t), o = Se({ store: u, to: "a", priority: "read" });
n === te && (o.data.softRead = 1);
let v = [o, W(r)];
return Q("storeOnMap", s, v, Be(e) && de(e)), Pe(e, t, v, n, a);
let m = [o, W(r)];
return Q("storeOnMap", u, m, Be(e) && de(e)), Pe(e, t, m, n, a);
};

@@ -424,12 +424,13 @@ let Ut = (e, t, n) => {

return t && V(t.activeEffects, n), n;
}, Xe = (e, t, n, r, a, s) => (o) => {
s.ref && le(s.ref.activeEffects, s), ee({ target: [r, Jt], params: [n ? { status: "done", params: e, result: o } : { status: "fail", params: e, error: o }, { value: o, fn: n ? t.rs : t.rj }], defer: 1, page: a.page, scope: s.ref, meta: a.meta });
}, Xe = (e, t, n, r, a, u) => (o) => {
u.ref && le(u.ref.activeEffects, u), ee({ target: [r, Jt], params: [n ? { status: "done", params: e, result: o } : { status: "fail", params: e, error: o }, { value: o, fn: n ? t.rs : t.rj }], defer: 1, page: a.page, scope: u.ref, meta: a.meta });
};
const Jt = N({ node: [qe({ fn: ({ fn: e, value: t }) => e(t) })], meta: { op: "fx", fx: "sidechain" } }), hr = bt(() => {
window.isBackFromBrowser = !1, window.history.back();
}), Ce = A(), Ie = A(), mt = A(), vt = A(), ht = A(), St = A(), Qt = $e({
}), Ce = A(), Ie = A(), mt = A(), vt = A(), ht = A(), St = A(), gt = A(), Qt = $e({
activeView: null,
activePanel: null,
activeModal: null,
activePopout: null
activePopout: null,
isRouteInit: !1
}).on(Ce, (e, t) => ({

@@ -453,2 +454,5 @@ ...e,

activePopout: t
})).on(gt, (e) => ({
...e,
isRouteInit: !0
}));

@@ -465,3 +469,3 @@ function Xt(e) {

}
}, Le = {}, ae = {}, er = {
}, Re = {}, ae = {}, er = {
get exports() {

@@ -473,3 +477,3 @@ return ae;

}
}, Re = {};
}, Le = {};
/**

@@ -487,14 +491,14 @@ * @license React

if (et)
return Re;
return Le;
et = 1;
var e = T;
function t(f, d) {
return f === d && (f !== 0 || 1 / f === 1 / d) || f !== f && d !== d;
function t(f, p) {
return f === p && (f !== 0 || 1 / f === 1 / p) || f !== f && p !== p;
}
var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, a = e.useEffect, s = e.useLayoutEffect, o = e.useDebugValue;
function v(f, d) {
var i = d(), u = r({ inst: { value: i, getSnapshot: d } }), l = u[0].inst, c = u[1];
return s(function() {
l.value = i, l.getSnapshot = d, _(l) && c({ inst: l });
}, [f, i, d]), a(function() {
var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, a = e.useEffect, u = e.useLayoutEffect, o = e.useDebugValue;
function m(f, p) {
var i = p(), s = r({ inst: { value: i, getSnapshot: p } }), l = s[0].inst, c = s[1];
return u(function() {
l.value = i, l.getSnapshot = p, _(l) && c({ inst: l });
}, [f, i, p]), a(function() {
return _(l) && c({ inst: l }), f(function() {

@@ -506,6 +510,6 @@ _(l) && c({ inst: l });

function _(f) {
var d = f.getSnapshot;
var p = f.getSnapshot;
f = f.value;
try {
var i = d();
var i = p();
return !n(f, i);

@@ -516,7 +520,7 @@ } catch {

}
function p(f, d) {
return d();
function d(f, p) {
return p();
}
var S = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? p : v;
return Re.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : S, Re;
var S = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : m;
return Le.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : S, Le;
}

@@ -540,3 +544,3 @@ var xe = {};

{
for (var m = arguments.length, y = new Array(m > 1 ? m - 1 : 0), h = 1; h < m; h++)
for (var v = arguments.length, y = new Array(v > 1 ? v - 1 : 0), h = 1; h < v; h++)
y[h - 1] = arguments[h];

@@ -546,22 +550,22 @@ r("error", w, y);

}
function r(w, m, y) {
function r(w, v, y) {
{
var h = t.ReactDebugCurrentFrame, g = h.getStackAddendum();
g !== "" && (m += "%s", y = y.concat([g]));
var E = y.map(function(R) {
return String(R);
g !== "" && (v += "%s", y = y.concat([g]));
var E = y.map(function(L) {
return String(L);
});
E.unshift("Warning: " + m), Function.prototype.apply.call(console[w], console, E);
E.unshift("Warning: " + v), Function.prototype.apply.call(console[w], console, E);
}
}
function a(w, m) {
return w === m && (w !== 0 || 1 / w === 1 / m) || w !== w && m !== m;
function a(w, v) {
return w === v && (w !== 0 || 1 / w === 1 / v) || w !== w && v !== v;
}
var s = typeof Object.is == "function" ? Object.is : a, o = e.useState, v = e.useEffect, _ = e.useLayoutEffect, p = e.useDebugValue, S = !1, f = !1;
function d(w, m, y) {
var u = typeof Object.is == "function" ? Object.is : a, o = e.useState, m = e.useEffect, _ = e.useLayoutEffect, d = e.useDebugValue, S = !1, f = !1;
function p(w, v, y) {
S || e.startTransition !== void 0 && (S = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
var h = m();
var h = v();
if (!f) {
var g = m();
s(h, g) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), f = !0);
var g = v();
u(h, g) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), f = !0);
}

@@ -571,26 +575,26 @@ var E = o({

value: h,
getSnapshot: m
getSnapshot: v
}
}), R = E[0].inst, U = E[1];
}), L = E[0].inst, U = E[1];
return _(function() {
R.value = h, R.getSnapshot = m, i(R) && U({
inst: R
L.value = h, L.getSnapshot = v, i(L) && U({
inst: L
});
}, [w, h, m]), v(function() {
i(R) && U({
inst: R
}, [w, h, v]), m(function() {
i(L) && U({
inst: L
});
var ge = function() {
i(R) && U({
inst: R
i(L) && U({
inst: L
});
};
return w(ge);
}, [w]), p(h), h;
}, [w]), d(h), h;
}
function i(w) {
var m = w.getSnapshot, y = w.value;
var v = w.getSnapshot, y = w.value;
try {
var h = m();
return !s(y, h);
var h = v();
return !u(y, h);
} catch {

@@ -600,7 +604,7 @@ return !0;

}
function u(w, m, y) {
return m();
function s(w, v, y) {
return v();
}
var l = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", c = !l, b = c ? u : d, L = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : b;
xe.useSyncExternalStore = L, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
var l = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", c = !l, b = c ? s : p, R = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : b;
xe.useSyncExternalStore = R, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
}()), xe;

@@ -624,32 +628,32 @@ }

if (rt)
return Le;
return Re;
rt = 1;
var e = T, t = ae;
function n(p, S) {
return p === S && (p !== 0 || 1 / p === 1 / S) || p !== p && S !== S;
function n(d, S) {
return d === S && (d !== 0 || 1 / d === 1 / S) || d !== d && S !== S;
}
var r = typeof Object.is == "function" ? Object.is : n, a = t.useSyncExternalStore, s = e.useRef, o = e.useEffect, v = e.useMemo, _ = e.useDebugValue;
return Le.useSyncExternalStoreWithSelector = function(p, S, f, d, i) {
var u = s(null);
if (u.current === null) {
var r = typeof Object.is == "function" ? Object.is : n, a = t.useSyncExternalStore, u = e.useRef, o = e.useEffect, m = e.useMemo, _ = e.useDebugValue;
return Re.useSyncExternalStoreWithSelector = function(d, S, f, p, i) {
var s = u(null);
if (s.current === null) {
var l = { hasValue: !1, value: null };
u.current = l;
s.current = l;
} else
l = u.current;
u = v(function() {
l = s.current;
s = m(function() {
function b(h) {
if (!L) {
if (L = !0, w = h, h = d(h), i !== void 0 && l.hasValue) {
if (!R) {
if (R = !0, w = h, h = p(h), i !== void 0 && l.hasValue) {
var g = l.value;
if (i(g, h))
return m = g;
return v = g;
}
return m = h;
return v = h;
}
if (g = m, r(w, h))
if (g = v, r(w, h))
return g;
var E = d(h);
return i !== void 0 && i(g, E) ? g : (w = h, m = E);
var E = p(h);
return i !== void 0 && i(g, E) ? g : (w = h, v = E);
}
var L = !1, w, m, y = f === void 0 ? null : f;
var R = !1, w, v, y = f === void 0 ? null : f;
return [function() {

@@ -660,8 +664,8 @@ return b(S());

}];
}, [S, f, d, i]);
var c = a(p, u[0], u[1]);
}, [S, f, p, i]);
var c = a(d, s[0], s[1]);
return o(function() {
l.hasValue = !0, l.value = c;
}, [c]), _(c), c;
}, Le;
}, Re;
}

@@ -686,5 +690,5 @@ var Ae = {};

}
var r = typeof Object.is == "function" ? Object.is : n, a = t.useSyncExternalStore, s = e.useRef, o = e.useEffect, v = e.useMemo, _ = e.useDebugValue;
function p(S, f, d, i, u) {
var l = s(null), c;
var r = typeof Object.is == "function" ? Object.is : n, a = t.useSyncExternalStore, u = e.useRef, o = e.useEffect, m = e.useMemo, _ = e.useDebugValue;
function d(S, f, p, i, s) {
var l = u(null), c;
l.current === null ? (c = {

@@ -694,3 +698,3 @@ hasValue: !1,

}, l.current = c) : c = l.current;
var b = v(function() {
var b = m(function() {
var y = !1, h, g, E = function(Y) {

@@ -700,5 +704,5 @@ if (!y) {

var _e = i(Y);
if (u !== void 0 && c.hasValue) {
if (s !== void 0 && c.hasValue) {
var ye = c.value;
if (u(ye, _e))
if (s(ye, _e))
return g = ye, ye;

@@ -708,19 +712,19 @@ }

}
var _t = h, we = g;
if (r(_t, Y))
var yt = h, we = g;
if (r(yt, Y))
return we;
var Ee = i(Y);
return u !== void 0 && u(we, Ee) ? we : (h = Y, g = Ee, Ee);
}, R = d === void 0 ? null : d, U = function() {
return s !== void 0 && s(we, Ee) ? we : (h = Y, g = Ee, Ee);
}, L = p === void 0 ? null : p, U = function() {
return E(f());
}, ge = R === null ? void 0 : function() {
return E(R());
}, ge = L === null ? void 0 : function() {
return E(L());
};
return [U, ge];
}, [f, d, i, u]), L = b[0], w = b[1], m = a(S, L, w);
}, [f, p, i, s]), R = b[0], w = b[1], v = a(S, R, w);
return o(function() {
c.hasValue = !0, c.value = m;
}, [m]), _(m), m;
c.hasValue = !0, c.value = v;
}, [v]), _(v), v;
}
Ae.useSyncExternalStoreWithSelector = p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
Ae.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
}()), Ae;

@@ -732,14 +736,14 @@ }

function ir(e, t, n, r) {
let a = [zt.run({ fn: (s) => t(s) })];
let a = [zt.run({ fn: (u) => t(u) })];
if (r && a.unshift(r), n) {
let s = N({ node: a }), o = e.graphite.id, v = n.additionalLinks, _ = v[o] || [];
return v[o] = _, _.push(s), () => {
let p = _.indexOf(s);
p !== -1 && _.splice(p, 1), Te(s);
let u = N({ node: a }), o = e.graphite.id, m = n.additionalLinks, _ = m[o] || [];
return m[o] = _, _.push(u), () => {
let d = _.indexOf(u);
d !== -1 && _.splice(d, 1), Te(u);
};
}
{
let s = N({ node: a, parent: [e], family: { owners: e } });
let u = N({ node: a, parent: [e], family: { owners: e } });
return () => {
Te(s);
Te(u);
};

@@ -749,3 +753,3 @@ }

function ur(e, t) {
kt.store(e) || gt("expect useStore argument to be a store");
kt.store(e) || _t("expect useStore argument to be a store");
let n = T.useCallback((a) => ir(e, a, t), [e, t]), r = T.useCallback(() => cr(e, t), [e, t]);

@@ -756,3 +760,3 @@ return fr(n, r, r);

let t = T.useContext(dr);
return e && !t && gt("No scope found, consider adding <Provider> to app root"), t;
return e && !t && _t("No scope found, consider adding <Provider> to app root"), t;
}

@@ -762,3 +766,3 @@ function lr(e, t) {

}
let gt = (e) => {
let _t = (e) => {
throw Error(e);

@@ -775,7 +779,7 @@ };

}, Sr = (e, ...t) => {
const { activeView: n, activePanel: r, activeModal: a, activePopout: s } = mr(), [o, v] = yt(!1);
const { activeView: n, activePanel: r, activeModal: a, activePopout: u, isRouteInit: o } = mr();
ke(() => {
Ce(e.view), Ie(e.panel), e.modal && mt(e.modal), e.popout && vt(e.popout), v(!0);
}, [e.view, e.panel, e.modal, e.popout]), ke(() => {
const _ = window.history.state ?? {
o || (Ce(e.view), Ie(e.panel), e.modal && mt(e.modal), e.popout && vt(e.popout), gt());
}, [e.view, e.panel, e.modal, e.popout, o]), ke(() => {
const m = window.history.state ?? {
view: void 0,

@@ -786,11 +790,11 @@ panel: void 0,

};
o && (_.view !== n || _.panel !== r || _.modal !== a || _.popout !== s) && window.history.pushState({
console.log(m, o, n, r, a, u, "push log"), o && (m.view !== n || m.panel !== r || m.modal !== a || m.popout !== u) && window.history.pushState({
view: n,
panel: r,
modal: a,
popout: s
popout: u
}, "");
}, [n, r, a, s, o]), pr("popstate", async () => {
await (async () => {
const { view: p, panel: S, modal: f, popout: d } = window.history.state ?? {
}, [n, r, a, u, o]), pr("popstate", async () => {
o && (await (async () => {
const { view: _, panel: d, modal: S, popout: f } = window.history.state ?? {
view: void 0,

@@ -801,15 +805,15 @@ panel: void 0,

};
console.log("prevRoutes", p, S, f, d), console.log("storeRoutes", n, r, a, s);
for (const i in t)
if (!await t[i]({
console.log("prevRoutes", _, d, S, f), console.log("storeRoutes", n, r, a, u);
for (const p in t)
if (!await t[p]({
view: n,
panel: r,
modal: a,
popout: s
}, { view: p, panel: S, modal: f, popout: d }))
popout: u
}, { view: _, panel: d, modal: S, popout: f }))
return;
Ce(p), Ie(S), ht(f), St(d);
})(), window.isBackFromBrowser = !0;
Ce(_), Ie(d), ht(S), St(f);
})(), window.isBackFromBrowser = !0);
});
}, mr = () => lr(Qt), gr = (e) => e, _r = (e, t) => (n, r) => ["view", "panel", "modal", "popout"].some((s) => n[s] === e && n[s] !== r[s]) && window.isBackFromBrowser ? (t && t(n, r), window.history.pushState(n, ""), !1) : !0;
}, mr = () => lr(Qt), gr = (e) => e, _r = (e, t) => (n, r) => ["view", "panel", "modal", "popout"].some((u) => n[u] === e && n[u] !== r[u]) && window.isBackFromBrowser ? (t && t(n, r), window.history.pushState(n, ""), !1) : !0;
export {

@@ -816,0 +820,0 @@ ht as _setActiveModal,

@@ -7,1 +7,2 @@ export declare const setActiveView: import("effector").Event<string>;

export declare const _setActivePopout: import("effector").Event<string | null>;
export declare const initRoute: import("effector").Event<void>;

@@ -6,4 +6,5 @@ type Store = {

activePopout: string | null;
isRouteInit: boolean;
};
export declare const $router: import("effector").Store<Store>;
export {};

@@ -7,2 +7,3 @@ export declare const useInitRouter: (options: InitRouteOptions, ...middlewares: RouteMiddleware[]) => void;

activePopout: string | null;
isRouteInit: boolean;
};

@@ -9,0 +10,0 @@ export declare const createRouteMiddleware: (callback: RouteMiddleware) => RouteMiddleware;

{
"name": "@blumjs/router",
"version": "1.0.7",
"version": "1.0.8",
"description": "",

@@ -5,0 +5,0 @@ "exports": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc