@blumjs/router
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -9,3 +9,3 @@ import T, { useEffect as B } from "react"; | ||
} | ||
function H(e, t) { | ||
function I(e, t) { | ||
if (!e) | ||
@@ -18,7 +18,7 @@ throw Error(t); | ||
let l = { id: Bt(), seq: a, next: le(o), meta: y, scope: m, family: { type: p.type || "crosslink", links: d, owners: u } }; | ||
return k(d, (f) => D(Se(f), l)), k(u, (f) => D(_e(f), l)), k(c, (f) => D(f.next, l)), S && G && Pe(Z(G), [l]), l; | ||
return k(d, (f) => D(Se(f), l)), k(u, (f) => D(ge(f), l)), k(c, (f) => D(f.next, l)), S && G && Pe(Z(G), [l]), l; | ||
} | ||
function te(e, t, n) { | ||
let r, i = M, s = null, o = b; | ||
if (e.target && (t = e.params, n = e.defer, r = e.meta, i = "page" in e ? e.page : i, e.stack && (s = e.stack), o = I(e) || o, e = e.target), o && b && o !== b && (b = null), Array.isArray(e)) | ||
let r, i = M, s = null, o = A; | ||
if (e.target && (t = e.params, n = e.defer, r = e.meta, i = "page" in e ? e.page : i, e.stack && (s = e.stack), o = H(e) || o, e = e.target), o && A && o !== A && (A = null), Array.isArray(e)) | ||
for (let a = 0; a < e.length; a++) | ||
@@ -30,3 +30,3 @@ $("pure", i, C(e[a]), s, t[a], o, r); | ||
return; | ||
let m, y, p, S, c, d, u = { isRoot: se, currentPage: M, scope: b, isWatch: fe, isPure: de }; | ||
let m, y, p, S, c, d, u = { isRoot: se, currentPage: M, scope: A, isWatch: fe, isPure: de }; | ||
se = 0; | ||
@@ -36,4 +36,4 @@ e: | ||
let { idx: a, stack: l, type: f } = S; | ||
p = l.node, M = c = l.page, b = I(l), c ? d = c.reg : b && (d = b.reg); | ||
let O = !!c, R = !!b, g = { fail: 0, scope: p.scope }; | ||
p = l.node, M = c = l.page, A = H(l), c ? d = c.reg : A && (d = A.reg); | ||
let O = !!c, b = !!A, _ = { fail: 0, scope: p.scope }; | ||
m = y = 0; | ||
@@ -43,22 +43,22 @@ for (let v = a; v < p.seq.length && !m; v++) { | ||
if (w.order) { | ||
let { priority: h, barrierID: _ } = w.order, E = _ ? c ? `${c.fullID}_${_}` : _ : 0; | ||
let { priority: h, barrierID: g } = w.order, E = g ? c ? `${c.fullID}_${g}` : g : 0; | ||
if (v !== a || f !== h) { | ||
_ ? Ae.has(E) || (Ae.add(E), Me(v, l, h, _)) : Me(v, l, h); | ||
g ? Ae.has(E) || (Ae.add(E), Me(v, l, h, g)) : Me(v, l, h); | ||
continue e; | ||
} | ||
_ && Ae.delete(E); | ||
g && Ae.delete(E); | ||
} | ||
switch (w.type) { | ||
case "mov": { | ||
let _, E = w.data; | ||
let g, E = w.data; | ||
switch (E.from) { | ||
case ne: | ||
_ = Z(l); | ||
g = Z(l); | ||
break; | ||
case "a": | ||
case "b": | ||
_ = l[E.from]; | ||
g = l[E.from]; | ||
break; | ||
case "value": | ||
_ = E.store; | ||
g = E.store; | ||
break; | ||
@@ -69,17 +69,17 @@ case "store": | ||
let L = ft(c, E.store.id); | ||
l.page = c = L, L ? d = L.reg : R ? (K(b, E.store, 0, 1, E.softRead), d = b.reg) : d = void 0; | ||
l.page = c = L, L ? d = L.reg : b ? (K(A, E.store, 0, 1, E.softRead), d = A.reg) : d = void 0; | ||
} else | ||
R && K(b, E.store, 0, 1, E.softRead); | ||
_ = ct(d && d[E.store.id] || E.store); | ||
b && K(A, E.store, 0, 1, E.softRead); | ||
g = ct(d && d[E.store.id] || E.store); | ||
} | ||
switch (E.to) { | ||
case ne: | ||
l.value = _; | ||
l.value = g; | ||
break; | ||
case "a": | ||
case "b": | ||
l[E.to] = _; | ||
l[E.to] = g; | ||
break; | ||
case "store": | ||
Xt(c, b, p, E.target).current = _; | ||
Xt(c, A, p, E.target).current = g; | ||
} | ||
@@ -92,10 +92,10 @@ break; | ||
fe = x(p, "op") === "watch", de = h.pure; | ||
let _ = h.safe ? (0, h.fn)(Z(l), g.scope, l) : er(g, h.fn, l); | ||
h.filter ? y = !_ : l.value = _, fe = u.isWatch, de = u.isPure; | ||
let g = h.safe ? (0, h.fn)(Z(l), _.scope, l) : er(_, h.fn, l); | ||
h.filter ? y = !g : l.value = g, fe = u.isWatch, de = u.isPure; | ||
} | ||
} | ||
m = g.fail || y; | ||
m = _.fail || y; | ||
} | ||
if (!m) { | ||
let v = Z(l), w = I(l); | ||
let v = Z(l), w = H(l); | ||
if (k(p.next, (h) => { | ||
@@ -106,4 +106,4 @@ $("child", c, h, l, v, w); | ||
let h = w.additionalLinks[p.id]; | ||
h && k(h, (_) => { | ||
$("child", c, _, l, v, w); | ||
h && k(h, (g) => { | ||
$("child", c, g, l, v, w); | ||
}); | ||
@@ -113,3 +113,3 @@ } | ||
} | ||
se = u.isRoot, M = u.currentPage, b = I(u); | ||
se = u.isRoot, M = u.currentPage, A = H(u); | ||
} | ||
@@ -133,3 +133,3 @@ function Dt(e, t) { | ||
} | ||
function A(e, t) { | ||
function R(e, t) { | ||
let n = U({ or: t, and: typeof e == "string" ? { name: e } : e }), r = (o, ...m) => (oe(!x(r, "derived"), "call of derived event", "createEvent"), oe(!de, "unit call from pure function", "operators like sample"), M ? ((y, p, S, c) => { | ||
@@ -143,4 +143,4 @@ let d = M, u = null; | ||
return Qe(d), a; | ||
})(r, i, o, m) : r.create(o, m)), i = lt(), s = Object.assign(r, { graphite: N({ meta: vt("event", r, n), regional: 1 }), create: (o) => (te({ target: r, params: o, scope: b }), o), watch: (o) => pt(r, o), map: (o) => Le(r, re, o, [q()]), filter: (o) => Le(r, "filter", o.fn ? o : o.fn, [q(ze, 1)]), filterMap: (o) => Le(r, "filterMap", o, [q(), F((m) => !j(m), 1)]), prepend(o) { | ||
let m = A("* → " + r.shortName, { parent: P(r) }); | ||
})(r, i, o, m) : r.create(o, m)), i = lt(), s = Object.assign(r, { graphite: N({ meta: vt("event", r, n), regional: 1 }), create: (o) => (te({ target: r, params: o, scope: A }), o), watch: (o) => pt(r, o), map: (o) => Le(r, re, o, [q()]), filter: (o) => Le(r, "filter", o.fn ? o : o.fn, [q(ze, 1)]), filterMap: (o) => Le(r, "filterMap", o, [q(), F((m) => !j(m), 1)]), prepend(o) { | ||
let m = R("* → " + r.shortName, { parent: P(r) }); | ||
return X("eventPrepend", C(m)), Ge(m, r, [q()], "prepend", o), tr(r, m), m; | ||
@@ -151,3 +151,3 @@ } }); | ||
function Fe(e, t, n, r) { | ||
return qt(n, t, "first argument"), H(V(r), "second argument should be a function"), oe(!x(e, "derived"), `${t} in derived store`, `${t} in store created via createStore`), k(Array.isArray(n) ? n : [n], (i) => { | ||
return qt(n, t, "first argument"), I(V(r), "second argument should be a function"), oe(!x(e, "derived"), `${t} in derived store`, `${t} in store created via createStore`), k(Array.isArray(n) ? n : [n], (i) => { | ||
e.off(i), me(e).set(i, dt(mt(i, e, "on", Wt, r))); | ||
@@ -157,3 +157,3 @@ }), e; | ||
function he(e, t) { | ||
let n = U(t), r = Ut(e), i = A({ named: "updates", derived: 1 }); | ||
let n = U(t), r = Ut(e), i = R({ named: "updates", derived: 1 }); | ||
X("storeBase", r); | ||
@@ -168,4 +168,4 @@ let s = r.id, o = { subscribers: /* @__PURE__ */ new Map(), updates: i, defaultState: e, stateRef: r, getState() { | ||
} | ||
return !a && b && (K(b, r, 1), a = b), a && (l = a.reg[s]), ct(l); | ||
}, setState: (a) => te({ target: o, params: a, defer: 1, scope: b }), reset: (...a) => (k(a, (l) => Fe(o, ".reset", l, () => o.defaultState)), o), on: (a, l) => Fe(o, ".on", a, l), off(a) { | ||
return !a && A && (K(A, r, 1), a = A), a && (l = a.reg[s]), ct(l); | ||
}, setState: (a) => te({ target: o, params: a, defer: 1, scope: A }), reset: (...a) => (k(a, (l) => Fe(o, ".reset", l, () => o.defaultState)), o), on: (a, l) => Fe(o, ".on", a, l), off(a) { | ||
let l = me(o).get(a); | ||
@@ -176,6 +176,6 @@ return l && (l(), me(o).delete(a)), o; | ||
z(a) && (f = a, a = a.fn), oe(j(l), "second argument of store.map", "updateFilter"); | ||
let R = o.getState(); | ||
j(R) || (O = a(R, l)); | ||
let g = he(O, { name: `${o.shortName} → *`, derived: 1, and: f }), v = mt(o, g, re, Ye, a); | ||
return Yt(ve(g), { type: re, fn: a, from: r }), ve(g).noInit = 1, X("storeMap", r, v), g; | ||
let b = o.getState(); | ||
j(b) || (O = a(b, l)); | ||
let _ = he(O, { name: `${o.shortName} → *`, derived: 1, and: f }), v = mt(o, _, re, Ye, a); | ||
return Yt(ve(_), { type: re, fn: a, from: r }), ve(_).noInit = 1, X("storeMap", r, v), _; | ||
}, watch(a, l) { | ||
@@ -186,7 +186,7 @@ if (!l || !$e(a)) { | ||
} | ||
return H(V(l), "second argument should be a function"), a.watch((f) => l(o.getState(), f)); | ||
return I(V(l), "second argument should be a function"), a.watch((f) => l(o.getState(), f)); | ||
} }, m = vt("store", o, n), y = o.defaultConfig.updateFilter; | ||
o.graphite = N({ scope: { state: r, fn: y }, node: [F((a, l, f) => (f.scope && !f.scope.reg[r.id] && (f.b = 1), a)), Ft(r), F((a, l, { a: f, b: O }) => !j(a) && (a !== f || O), 1), y && q(Ye, 1), ye({ from: ne, target: r })], child: i, meta: m, regional: 1 }); | ||
let p = x(o, "serialize"), S = x(o, "derived"), c = p === "ignore", d = !p || c ? 0 : p, u = x(o, "sid"); | ||
return u && (c || ee(o, "storeChange", 1), r.sid = u, d && (r.meta = { ...r == null ? void 0 : r.meta, serialize: d })), u || c || S || ee(o, "warnSerialize", 1), H(S || !j(e), "current state can't be undefined, use null instead"), Pe(o, [i]), n != null && n.domain && n.domain.hooks.store(o), S || (o.reinit = A(), o.reset(o.reinit)), o; | ||
return u && (c || ee(o, "storeChange", 1), r.sid = u, d && (r.meta = { ...r == null ? void 0 : r.meta, serialize: d })), u || c || S || ee(o, "warnSerialize", 1), I(S || !j(e), "current state can't be undefined, use null instead"), Pe(o, [i]), n != null && n.domain && n.domain.hooks.store(o), S || (o.reinit = R(), o.reset(o.reinit)), o; | ||
} | ||
@@ -201,5 +201,5 @@ function Mt() { | ||
function at(e, t) { | ||
let n = U(V(e) ? { handler: e } : e, t), r = A(V(e) ? { handler: e } : e, t), i = C(r); | ||
ee(i, "op", r.kind = "effect"), r.use = (u) => (H(V(u), ".use argument should be a function"), S.scope.handler = u, 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: u, params: a, result: l }) { | ||
let n = U(V(e) ? { handler: e } : e, t), r = R(V(e) ? { handler: e } : e, t), i = C(r); | ||
ee(i, "op", r.kind = "effect"), r.use = (u) => (I(V(u), ".use argument should be a function"), S.scope.handler = u, r), r.use.getCurrent = () => S.scope.handler; | ||
let s = r.finally = R({ named: "finally", derived: 1 }), o = r.done = s.filterMap({ named: "done", fn({ status: u, params: a, result: l }) { | ||
if (u === "done") | ||
@@ -210,12 +210,12 @@ return { params: a, result: l }; | ||
return { params: a, error: l }; | ||
} }), y = r.doneData = o.map({ named: "doneData", fn: ({ result: u }) => u }), p = r.failData = m.map({ named: "failData", fn: ({ error: u }) => u }), S = N({ scope: { handlerId: x(i, "sid"), handler: r.defaultConfig.handler || (() => H(0, `no handler used in ${r.getType()}`)) }, node: [F((u, a, l) => { | ||
} }), y = r.doneData = o.map({ named: "doneData", fn: ({ result: u }) => u }), p = r.failData = m.map({ named: "failData", fn: ({ error: u }) => u }), S = N({ scope: { handlerId: x(i, "sid"), handler: r.defaultConfig.handler || (() => I(0, `no handler used in ${r.getType()}`)) }, node: [F((u, a, l) => { | ||
let f = a, O = f.handler; | ||
if (I(l)) { | ||
let R = I(l).handlers[f.handlerId]; | ||
R && (O = R); | ||
if (H(l)) { | ||
let b = H(l).handlers[f.handlerId]; | ||
b && (O = b); | ||
} | ||
return u.handler = O, u; | ||
}, 0, 1), F(({ params: u, req: a, handler: l, args: f = [u] }, O, R) => { | ||
let g = nr(R), v = Ze(u, a, 1, s, R, g), w = Ze(u, a, 0, s, R, g), [h, _] = rr(l, w, f); | ||
h && (z(_) && V(_.then) ? _.then(v, w) : v(_)); | ||
}, 0, 1), F(({ params: u, req: a, handler: l, args: f = [u] }, O, b) => { | ||
let _ = nr(b), v = Ze(u, a, 1, s, b, _), w = Ze(u, a, 0, s, b, _), [h, g] = rr(l, w, f); | ||
h && (z(g) && V(g.then) ? g.then(v, w) : v(g)); | ||
}, 0, 1)], meta: { op: "fx", fx: "runner" } }); | ||
@@ -226,7 +226,7 @@ i.scope.runner = S, D(i.seq, F((u, { runner: a }, l) => { | ||
} } } : u; | ||
return l.meta || (l.meta = { fxID: Pt() }), te({ target: a, params: f, defer: 1, scope: I(l), meta: l.meta }), f.params; | ||
return l.meta || (l.meta = { fxID: Pt() }), te({ target: a, params: f, defer: 1, scope: H(l), meta: l.meta }), f.params; | ||
}, 0, 1)), r.create = (u) => { | ||
let a = Mt(), l = { params: u, req: a }; | ||
if (b && !fe) { | ||
let f = b; | ||
if (A && !fe) { | ||
let f = A; | ||
a.req.finally(() => { | ||
@@ -237,3 +237,3 @@ Qt(f); | ||
} | ||
return te({ target: r, params: l, scope: b }), a.req; | ||
return te({ target: r, params: l, scope: A }), a.req; | ||
}; | ||
@@ -245,6 +245,6 @@ let c = r.inFlight = he(0, { serialize: "ignore" }).on(r, (u) => u + 1).on(s, (u) => u - 1).map({ fn: (u) => u, named: "inFlight" }); | ||
} | ||
let Tt = typeof Symbol < "u" && Symbol.observable || "@@observable", re = "map", ne = "stack", C = (e) => e.graphite || e, Se = (e) => e.family.owners, _e = (e) => e.family.links, ve = (e) => e.stateRef, Z = (e) => e.value, me = (e) => e.subscribers, P = (e) => e.parent, I = (e) => e.scope, x = (e, t) => C(e).meta[t], ee = (e, t, n) => C(e).meta[t] = n, Ct = (e) => e.compositeName, $e = (e) => (V(e) || z(e)) && "kind" in e; | ||
let Tt = typeof Symbol < "u" && Symbol.observable || "@@observable", re = "map", ne = "stack", C = (e) => e.graphite || e, Se = (e) => e.family.owners, ge = (e) => e.family.links, ve = (e) => e.stateRef, Z = (e) => e.value, me = (e) => e.subscribers, P = (e) => e.parent, H = (e) => e.scope, x = (e, t) => C(e).meta[t], ee = (e, t, n) => C(e).meta[t] = n, Ct = (e) => e.compositeName, $e = (e) => (V(e) || z(e)) && "kind" in e; | ||
const ue = (e) => (t) => $e(t) && t.kind === e; | ||
let Be = ue("store"), It = ue("event"), Ke = ue("effect"), it = ue("domain"), Ht = ue("scope"); | ||
var Nt = { __proto__: null, unit: $e, store: Be, event: It, effect: Ke, domain: it, scope: Ht, attached: (e) => Ke(e) && x(e, "attached") == 1 }; | ||
let Be = ue("store"), Ht = ue("event"), Ke = ue("effect"), it = ue("domain"), It = ue("scope"); | ||
var Nt = { __proto__: null, unit: $e, store: Be, event: Ht, effect: Ke, domain: it, scope: It, attached: (e) => Ke(e) && x(e, "attached") == 1 }; | ||
let ce = (e, t) => { | ||
@@ -254,14 +254,14 @@ let n = e.indexOf(t); | ||
}, D = (e, t) => e.push(t), oe = (e, t, n) => !e && console.error(`${t} is deprecated${n ? `, use ${n} instead` : ""}`); | ||
const ge = () => { | ||
const _e = () => { | ||
let e = 0; | ||
return () => "" + ++e; | ||
}; | ||
let $t = ge(), ut = ge(), Bt = ge(), Pt = ge(), G = null, lt = () => G, zt = (e) => (e && G && G.sidRoot && (e = `${G.sidRoot}|${e}`), e), Pe = (e, t) => { | ||
let $t = _e(), ut = _e(), Bt = _e(), Pt = _e(), G = null, lt = () => G, zt = (e) => (e && G && G.sidRoot && (e = `${G.sidRoot}|${e}`), e), Pe = (e, t) => { | ||
let n = C(e); | ||
k(t, (r) => { | ||
let i = C(r); | ||
n.family.type !== "domain" && (i.family.type = "crosslink"), D(Se(i), n), D(_e(n), i); | ||
n.family.type !== "domain" && (i.family.type = "crosslink"), D(Se(i), n), D(ge(n), i); | ||
}); | ||
}, le = (e = []) => (Array.isArray(e) ? e : [e]).flat().map(C), z = (e) => typeof e == "object" && e !== null, V = (e) => typeof e == "function", j = (e) => e === void 0, jt = (e) => H(z(e) || V(e), "expect first argument be an object"); | ||
const Ue = (e, t, n, r) => H(!(!z(e) && !V(e) || !("family" in e) && !("graphite" in e)), `${t}: expect ${n} to be a unit (store, event or effect)${r}`); | ||
}, le = (e = []) => (Array.isArray(e) ? e : [e]).flat().map(C), z = (e) => typeof e == "object" && e !== null, V = (e) => typeof e == "function", j = (e) => e === void 0, jt = (e) => I(z(e) || V(e), "expect first argument be an object"); | ||
const Ue = (e, t, n, r) => I(!(!z(e) && !V(e) || !("family" in e) && !("graphite" in e)), `${t}: expect ${n} to be a unit (store, event or effect)${r}`); | ||
let qt = (e, t, n) => { | ||
@@ -323,4 +323,4 @@ Array.isArray(e) ? k(e, (r, i) => Ue(r, t, `${i} item of ${n}`, "")) : Ue(e, t, n, " or array of units"); | ||
}, Ae = /* @__PURE__ */ new Set(); | ||
let b, se = 1, fe = 0, de = 0, M = null, Qt = (e) => { | ||
b = e; | ||
let A, se = 1, fe = 0, de = 0, M = null, Qt = (e) => { | ||
A = e; | ||
}, Qe = (e) => { | ||
@@ -382,7 +382,7 @@ M = e; | ||
const Xe = (e, t) => { | ||
ce(e.next, t), ce(Se(e), t), ce(_e(e), t); | ||
ce(e.next, t), ce(Se(e), t), ce(ge(e), t); | ||
}, Ce = (e, t, n) => { | ||
let r; | ||
e.next.length = 0, e.seq.length = 0, e.scope = null; | ||
let i = _e(e); | ||
let i = ge(e); | ||
for (; r = i.pop(); ) | ||
@@ -393,3 +393,3 @@ Xe(r, e), (t || n && x(e, "op") !== "sample" || r.family.type === "crosslink") && Ce(r, t, x(r, "op") !== "on" && n); | ||
}, Q = (e) => e.clear(); | ||
let Ie = (e, { deep: t } = {}) => { | ||
let He = (e, { deep: t } = {}) => { | ||
let n = 0; | ||
@@ -405,5 +405,5 @@ if (e.ownerSet && e.ownerSet.delete(e), Be(e)) | ||
}, dt = (e) => { | ||
let t = () => Ie(e); | ||
let t = () => He(e); | ||
return t.unsubscribe = t, t; | ||
}, Ge = (e, t, n, r, i) => N({ node: n, parent: e, child: t, scope: { fn: i }, meta: { op: r }, family: { owners: [e, t], links: t }, regional: 1 }), pt = (e, t) => (H(V(t), ".watch argument should be a function"), dt(N({ scope: { fn: t }, node: [je({ fn: ze })], parent: e, meta: { op: "watch" }, family: { owners: e }, regional: 1 }))), tr = (e, t, n = "event") => { | ||
}, Ge = (e, t, n, r, i) => N({ node: n, parent: e, child: t, scope: { fn: i }, meta: { op: r }, family: { owners: [e, t], links: t }, regional: 1 }), pt = (e, t) => (I(V(t), ".watch argument should be a function"), dt(N({ scope: { fn: t }, node: [je({ fn: ze })], parent: e, meta: { op: "watch" }, family: { owners: e }, regional: 1 }))), tr = (e, t, n = "event") => { | ||
P(e) && P(e).hooks[n](t); | ||
@@ -417,3 +417,3 @@ }, vt = (e, t, n) => { | ||
z(n) && (i = n, n = n.fn); | ||
let s = A({ name: `${e.shortName} → *`, derived: 1, and: i }); | ||
let s = R({ name: `${e.shortName} → *`, derived: 1, and: i }); | ||
return Ge(e, s, r, t, n), s; | ||
@@ -433,3 +433,3 @@ }, mt = (e, t, n, r, i) => { | ||
}, nr = (e) => { | ||
let t = I(e), n = { ref: t }; | ||
let t = H(e), n = { ref: t }; | ||
return t && D(t.activeEffects, n), n; | ||
@@ -443,3 +443,3 @@ }, Ze = (e, t, n, r, i, s) => (o) => { | ||
window.history.pushState(e, ""); | ||
}), ar = A(), ir = A(), St = A(), _t = A(), gt = A(), yt = A(), He = A(), ur = he({ | ||
}), ar = R(), ir = R(), St = R(), gt = R(), _t = R(), yt = R(), Ie = R(), ur = he({ | ||
activeView: null, | ||
@@ -457,6 +457,6 @@ activePanel: null, | ||
activePanel: t | ||
})).on(_t, (e, t) => ({ | ||
})).on(gt, (e, t) => ({ | ||
...e, | ||
activeModal: t | ||
})).on(gt, (e, t) => ({ | ||
})).on(_t, (e, t) => ({ | ||
...e, | ||
@@ -471,3 +471,3 @@ activePopout: t | ||
activePanel: n | ||
})).on(He, (e, t) => ({ | ||
})).on(Ie, (e, t) => ({ | ||
...e, | ||
@@ -554,29 +554,29 @@ isBackHandled: t | ||
var e = T, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function n(g) { | ||
function n(_) { | ||
{ | ||
for (var v = arguments.length, w = new Array(v > 1 ? v - 1 : 0), h = 1; h < v; h++) | ||
w[h - 1] = arguments[h]; | ||
r("error", g, w); | ||
r("error", _, w); | ||
} | ||
} | ||
function r(g, v, w) { | ||
function r(_, v, w) { | ||
{ | ||
var h = t.ReactDebugCurrentFrame, _ = h.getStackAddendum(); | ||
_ !== "" && (v += "%s", w = w.concat([_])); | ||
var h = t.ReactDebugCurrentFrame, g = h.getStackAddendum(); | ||
g !== "" && (v += "%s", w = w.concat([g])); | ||
var E = w.map(function(L) { | ||
return String(L); | ||
}); | ||
E.unshift("Warning: " + v), Function.prototype.apply.call(console[g], console, E); | ||
E.unshift("Warning: " + v), Function.prototype.apply.call(console[_], console, E); | ||
} | ||
} | ||
function i(g, v) { | ||
return g === v && (g !== 0 || 1 / g === 1 / v) || g !== g && v !== v; | ||
function i(_, v) { | ||
return _ === v && (_ !== 0 || 1 / _ === 1 / v) || _ !== _ && v !== v; | ||
} | ||
var s = typeof Object.is == "function" ? Object.is : i, o = e.useState, m = e.useEffect, y = e.useLayoutEffect, p = e.useDebugValue, S = !1, c = !1; | ||
function d(g, v, w) { | ||
function d(_, v, w) { | ||
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 = v(); | ||
if (!c) { | ||
var _ = v(); | ||
s(h, _) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0); | ||
var g = v(); | ||
s(h, g) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0); | ||
} | ||
@@ -593,3 +593,3 @@ var E = o({ | ||
}); | ||
}, [g, h, v]), m(function() { | ||
}, [_, h, v]), m(function() { | ||
u(L) && Y({ | ||
@@ -603,7 +603,7 @@ inst: L | ||
}; | ||
return g(we); | ||
}, [g]), p(h), h; | ||
return _(we); | ||
}, [_]), p(h), h; | ||
} | ||
function u(g) { | ||
var v = g.getSnapshot, w = g.value; | ||
function u(_) { | ||
var v = _.getSnapshot, w = _.value; | ||
try { | ||
@@ -616,7 +616,7 @@ var h = v(); | ||
} | ||
function a(g, v, w) { | ||
function a(_, v, w) { | ||
return v(); | ||
} | ||
var l = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", f = !l, O = f ? a : d, R = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : O; | ||
Ve.useSyncExternalStore = R, 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", f = !l, O = f ? a : d, b = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : O; | ||
Ve.useSyncExternalStore = b, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
}()), Ve; | ||
@@ -656,16 +656,16 @@ } | ||
function O(h) { | ||
if (!R) { | ||
if (R = !0, g = h, h = d(h), u !== void 0 && l.hasValue) { | ||
var _ = l.value; | ||
if (u(_, h)) | ||
return v = _; | ||
if (!b) { | ||
if (b = !0, _ = h, h = d(h), u !== void 0 && l.hasValue) { | ||
var g = l.value; | ||
if (u(g, h)) | ||
return v = g; | ||
} | ||
return v = h; | ||
} | ||
if (_ = v, r(g, h)) | ||
return _; | ||
if (g = v, r(_, h)) | ||
return g; | ||
var E = d(h); | ||
return u !== void 0 && u(_, E) ? _ : (g = h, v = E); | ||
return u !== void 0 && u(g, E) ? g : (_ = h, v = E); | ||
} | ||
var R = !1, g, v, w = c === void 0 ? null : c; | ||
var b = !1, _, v, w = c === void 0 ? null : c; | ||
return [function() { | ||
@@ -709,3 +709,3 @@ return O(S()); | ||
var O = m(function() { | ||
var w = !1, h, _, E = function(J) { | ||
var w = !1, h, g, E = function(J) { | ||
if (!w) { | ||
@@ -717,11 +717,11 @@ w = !0, h = J; | ||
if (a(Oe, Ee)) | ||
return _ = Oe, Oe; | ||
return g = Oe, Oe; | ||
} | ||
return _ = Ee, Ee; | ||
return g = Ee, Ee; | ||
} | ||
var kt = h, Re = _; | ||
var kt = h, Re = g; | ||
if (r(kt, J)) | ||
return Re; | ||
var be = u(J); | ||
return a !== void 0 && a(Re, be) ? Re : (h = J, _ = be, be); | ||
return a !== void 0 && a(Re, be) ? Re : (h = J, g = be, be); | ||
}, L = d === void 0 ? null : d, Y = function() { | ||
@@ -733,3 +733,3 @@ return E(c()); | ||
return [Y, we]; | ||
}, [c, d, u, a]), R = O[0], g = O[1], v = i(S, R, g); | ||
}, [c, d, u, a]), b = O[0], _ = O[1], v = i(S, b, _); | ||
return o(function() { | ||
@@ -751,3 +751,3 @@ f.hasValue = !0, f.value = v; | ||
let p = y.indexOf(s); | ||
p !== -1 && y.splice(p, 1), Ie(s); | ||
p !== -1 && y.splice(p, 1), He(s); | ||
}; | ||
@@ -758,3 +758,3 @@ } | ||
return () => { | ||
Ie(s); | ||
He(s); | ||
}; | ||
@@ -766,5 +766,5 @@ } | ||
let n = T.useCallback((i) => hr(e, i, t), [e, t]), r = T.useCallback(() => yr(e, t), [e, t]); | ||
return gr(n, r, r); | ||
return _r(n, r, r); | ||
} | ||
function _r(e) { | ||
function gr(e) { | ||
let t = T.useContext(wr); | ||
@@ -774,3 +774,3 @@ return e && !t && Et("No scope found, consider adding <Provider> to app root"), t; | ||
function wt(e, t) { | ||
return Sr(e, _r(t == null ? void 0 : t.forceScope)); | ||
return Sr(e, gr(t == null ? void 0 : t.forceScope)); | ||
} | ||
@@ -781,3 +781,3 @@ let Et = (e) => { | ||
typeof window < "u" ? T.useLayoutEffect : T.useEffect; | ||
const { useSyncExternalStore: gr } = pr, yr = (e, t) => t ? t.getState(e) : e.getState(), wr = T.createContext(null), Er = (e, t, n) => { | ||
const { useSyncExternalStore: _r } = pr, yr = (e, t) => t ? t.getState(e) : e.getState(), wr = T.createContext(null), Er = (e, t, n) => { | ||
B(() => { | ||
@@ -789,5 +789,7 @@ const r = (i) => { | ||
}, [e, n, t]); | ||
}, Ot = A(), Rt = A(), Or = A(), bt = A(), At = A(); | ||
A(); | ||
const pe = A(), Lt = A(), xt = A(), Ne = A(), Rr = he({ | ||
}, Ot = R(), Rt = R(), Or = R(), bt = R(), At = R(); | ||
R(); | ||
const pe = R(), Lt = R(), xt = R(), Ne = R(); | ||
R(); | ||
const Rr = he({ | ||
isRoutesHandled: !0, | ||
@@ -817,5 +819,5 @@ notHandledRoutes: [], | ||
notHandledRoutes: [t, ...e.notHandledRoutes] | ||
})).on(xt, (e) => ({ | ||
})).on(xt, (e, t) => ({ | ||
...e, | ||
notHandledRoutes: [] | ||
notHandledRoutes: [...e.notHandledRoutes.slice(t)] | ||
})).on(Ne, (e, t) => ({ | ||
@@ -842,4 +844,4 @@ ...e, | ||
m && u && d.length > 0 && (console.log("routes quque", d), Ne(!1), d.forEach((a) => { | ||
a.view && a.panel && St({ view: a.view, panel: a.panel }), a.modal && _t(a.modal), a.popout && gt(a.popout); | ||
}), xt(), Ne(!0), o || yt()); | ||
a.view && a.panel && St({ view: a.view, panel: a.panel }), a.modal && gt(a.modal), a.popout && _t(a.popout); | ||
}), xt(d.length), Ne(!0), o || yt()); | ||
}, [m, o, d, u]), B(() => { | ||
@@ -854,4 +856,4 @@ o && ht({ | ||
o && (await (async () => { | ||
He(!1); | ||
const { view: l, panel: f, modal: O, popout: R } = window.history.state ?? { | ||
Ie(!1); | ||
const { view: l, panel: f, modal: O, popout: b } = window.history.state ?? { | ||
view: void 0, | ||
@@ -862,5 +864,5 @@ panel: void 0, | ||
}; | ||
console.log("prevRoutes", l, f, O, R), console.log("storeRoutes", n, r, i, s); | ||
for (const g in t) | ||
if (!await t[g]({ | ||
console.log("prevRoutes", l, f, O, b), console.log("storeRoutes", n, r, i, s); | ||
for (const _ in t) | ||
if (!await t[_]({ | ||
view: n, | ||
@@ -870,5 +872,5 @@ panel: r, | ||
popout: s | ||
}, { view: l, panel: f, modal: O, popout: R })) | ||
}, { view: l, panel: f, modal: O, popout: b })) | ||
return; | ||
Lt({ view: l, panel: f, modal: O, popout: R }), He(!0); | ||
Lt({ view: l, panel: f, modal: O, popout: b }), Ie(!0); | ||
})(), window.isBackFromBrowser = !0); | ||
@@ -878,5 +880,5 @@ }); | ||
export { | ||
_t as _setActiveModal, | ||
gt as _setActiveModal, | ||
ir as _setActivePanel, | ||
gt as _setActivePopout, | ||
_t as _setActivePopout, | ||
ar as _setActiveView, | ||
@@ -883,0 +885,0 @@ Lr as back, |
@@ -13,3 +13,4 @@ import { Routes } from "src/types"; | ||
export declare const pushInStartNotHandledRoutes: import("effector").Event<Partial<Routes>>; | ||
export declare const dropNotHandledRoutes: import("effector").Event<void>; | ||
export declare const dropHandledRoutes: import("effector").Event<number>; | ||
export declare const setRoutesHandled: import("effector").Event<boolean>; | ||
export declare const setVirtualRoutesInit: import("effector").Event<boolean>; |
{ | ||
"name": "@blumjs/router", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63902
1063