@blumjs/router
Advanced tools
Comparing version 7.9.4 to 7.10.0
@@ -1,7 +0,7 @@ | ||
import { Routes } from "./types"; | ||
import { Routes, SetRouteOptions } from "./types"; | ||
export declare const blumRouter: { | ||
subscribers: Subscriber[]; | ||
historyPush(routes: Partial<Routes>): void; | ||
changeState(routes: BlumRouterEventMap["changestate"]): void; | ||
dispatchChangeStateEvent(): void; | ||
historyPush(routes: Partial<Routes>, options?: SetRouteOptions): void; | ||
changeState(config: BlumRouterEventMap["changestate"]): void; | ||
dispatchChangeStateEvent(options?: SetRouteOptions): void; | ||
addEventListener<K extends keyof BlumRouterEventMap>(type: K, callback: (payload: BlumRouterEventMap[K]) => void, index: number): void; | ||
@@ -12,3 +12,5 @@ removeEventListener(index: number): void; | ||
export type BlumRouterEventMap = { | ||
changestate: Routes | null; | ||
changestate: (Routes & { | ||
options?: SetRouteOptions; | ||
}) | null; | ||
init: boolean; | ||
@@ -15,0 +17,0 @@ }; |
@@ -1,6 +0,6 @@ | ||
import D, { useEffect as tt } from "react"; | ||
import D, { useEffect as Pe } from "react"; | ||
const M = { | ||
subscribers: [], | ||
historyPush(e) { | ||
const { view: t, panel: r, modal: n, popout: o } = window.history.state ?? { | ||
historyPush(e, t) { | ||
const { view: r, panel: n, modal: o, popout: l } = window.history.state ?? { | ||
view: void 0, | ||
@@ -12,6 +12,7 @@ panel: void 0, | ||
this.changeState({ | ||
view: e.hasOwnProperty("view") ? e.view : t, | ||
panel: e.hasOwnProperty("panel") ? e.panel : r, | ||
modal: e.hasOwnProperty("modal") ? e.modal : n, | ||
popout: e.hasOwnProperty("popout") ? e.popout : o | ||
view: e.hasOwnProperty("view") ? e.view : r, | ||
panel: e.hasOwnProperty("panel") ? e.panel : n, | ||
modal: e.hasOwnProperty("modal") ? e.modal : o, | ||
popout: e.hasOwnProperty("popout") ? e.popout : l, | ||
options: t | ||
}); | ||
@@ -21,3 +22,8 @@ }, | ||
try { | ||
window.history.pushState(e, ""), this.dispatchChangeStateEvent(); | ||
window.history.pushState({ | ||
view: e == null ? void 0 : e.view, | ||
panel: e == null ? void 0 : e.panel, | ||
modal: e == null ? void 0 : e.modal, | ||
popout: e == null ? void 0 : e.popout | ||
}, ""), this.dispatchChangeStateEvent(e == null ? void 0 : e.options); | ||
} catch (t) { | ||
@@ -27,4 +33,4 @@ console.log("changeState err", t); | ||
}, | ||
dispatchChangeStateEvent() { | ||
this._trigerEvent("changestate", window.history.state); | ||
dispatchChangeStateEvent(e) { | ||
this._trigerEvent("changestate", { ...window.history.state, options: e }); | ||
}, | ||
@@ -52,7 +58,7 @@ addEventListener(e, t, r) { | ||
} | ||
function x({ node: e = [], from: t, source: r, parent: n = t || r, to: o, target: l, child: a = o || l, scope: p = {}, meta: y = {}, family: v = { type: "regular" }, regional: d } = {}) { | ||
let c = ie(n), f = ie(v.links), i = ie(v.owners), u = []; | ||
L(e, (S) => S && P(u, S)); | ||
let s = { id: Rt(), seq: u, next: ie(a), meta: y, scope: p, family: { type: v.type || "crosslink", links: f, owners: i } }; | ||
return L(f, (S) => P(ce(S), s)), L(i, (S) => P(fe(S), s)), L(c, (S) => P(S.next, s)), d && z && lt(Q(z), [s]), s; | ||
function x({ node: e = [], from: t, source: r, parent: n = t || r, to: o, target: l, child: a = o || l, scope: f = {}, meta: y = {}, family: v = { type: "regular" }, regional: p } = {}) { | ||
let c = ie(n), d = ie(v.links), i = ie(v.owners), u = []; | ||
L(e, (h) => h && P(u, h)); | ||
let s = { id: Rt(), seq: u, next: ie(a), meta: y, scope: f, family: { type: v.type || "crosslink", links: d, owners: i } }; | ||
return L(d, (h) => P(ce(h), s)), L(i, (h) => P(de(h), s)), L(c, (h) => P(h.next, s)), p && z && lt(Q(z), [s]), s; | ||
} | ||
@@ -68,53 +74,53 @@ function rt(e, t, r) { | ||
return; | ||
let p, y, v, d, c, f, i = { isRoot: oe, currentPage: R, scope: O, isWatch: we, isPure: se }; | ||
let f, y, v, p, c, d, i = { isRoot: oe, currentPage: R, scope: O, isWatch: _e, isPure: se }; | ||
oe = 0; | ||
e: | ||
for (; d = $t(); ) { | ||
let { idx: u, stack: s, type: S } = d; | ||
v = s.node, R = c = s.page, O = ae(s), c ? f = c.reg : O && (f = O.reg); | ||
let k = !!c, B = !!O, E = { fail: 0, scope: v.scope }; | ||
p = y = 0; | ||
for (let h = u; h < v.seq.length && !p; h++) { | ||
let w = v.seq[h]; | ||
if (w.order) { | ||
let { priority: m, barrierID: g } = w.order, _ = g ? c ? `${c.fullID}_${g}` : g : 0; | ||
if (h !== u || S !== m) { | ||
g ? ye.has(_) || (ye.add(_), Ce(h, s, m, g)) : Ce(h, s, m); | ||
for (; p = $t(); ) { | ||
let { idx: u, stack: s, type: h } = p; | ||
v = s.node, R = c = s.page, O = ae(s), c ? d = c.reg : O && (d = O.reg); | ||
let B = !!c, b = !!O, E = { fail: 0, scope: v.scope }; | ||
f = y = 0; | ||
for (let m = u; m < v.seq.length && !f; m++) { | ||
let _ = v.seq[m]; | ||
if (_.order) { | ||
let { priority: S, barrierID: w } = _.order, g = w ? c ? `${c.fullID}_${w}` : w : 0; | ||
if (m !== u || h !== S) { | ||
w ? ye.has(g) || (ye.add(g), Ce(m, s, S, w)) : Ce(m, s, S); | ||
continue e; | ||
} | ||
g && ye.delete(_); | ||
w && ye.delete(g); | ||
} | ||
switch (w.type) { | ||
switch (_.type) { | ||
case "mov": { | ||
let g, _ = w.data; | ||
switch (_.from) { | ||
let w, g = _.data; | ||
switch (g.from) { | ||
case Z: | ||
g = Q(s); | ||
w = Q(s); | ||
break; | ||
case "a": | ||
case "b": | ||
g = s[_.from]; | ||
w = s[g.from]; | ||
break; | ||
case "value": | ||
g = _.store; | ||
w = g.store; | ||
break; | ||
case "store": | ||
if (f && !f[_.store.id]) | ||
if (k) { | ||
let b = ft(c, _.store.id); | ||
s.page = c = b, b ? f = b.reg : B ? (F(O, _.store, 0, 1, _.softRead), f = O.reg) : f = void 0; | ||
if (d && !d[g.store.id]) | ||
if (B) { | ||
let k = dt(c, g.store.id); | ||
s.page = c = k, k ? d = k.reg : b ? (F(O, g.store, 0, 1, g.softRead), d = O.reg) : d = void 0; | ||
} else | ||
B && F(O, _.store, 0, 1, _.softRead); | ||
g = ct(f && f[_.store.id] || _.store); | ||
b && F(O, g.store, 0, 1, g.softRead); | ||
w = ct(d && d[g.store.id] || g.store); | ||
} | ||
switch (_.to) { | ||
switch (g.to) { | ||
case Z: | ||
s.value = g; | ||
s.value = w; | ||
break; | ||
case "a": | ||
case "b": | ||
s[_.to] = g; | ||
s[g.to] = w; | ||
break; | ||
case "store": | ||
zt(c, O, v, _.target).current = g; | ||
zt(c, O, v, g.target).current = w; | ||
} | ||
@@ -124,20 +130,20 @@ break; | ||
case "compute": | ||
let m = w.data; | ||
if (m.fn) { | ||
we = C(v, "op") === "watch", se = m.pure; | ||
let g = m.safe ? (0, m.fn)(Q(s), E.scope, s) : Wt(E, m.fn, s); | ||
m.filter ? y = !g : s.value = g, we = i.isWatch, se = i.isPure; | ||
let S = _.data; | ||
if (S.fn) { | ||
_e = C(v, "op") === "watch", se = S.pure; | ||
let w = S.safe ? (0, S.fn)(Q(s), E.scope, s) : Wt(E, S.fn, s); | ||
S.filter ? y = !w : s.value = w, _e = i.isWatch, se = i.isPure; | ||
} | ||
} | ||
p = E.fail || y; | ||
f = E.fail || y; | ||
} | ||
if (!p) { | ||
let h = Q(s), w = ae(s); | ||
if (L(v.next, (m) => { | ||
V("child", c, m, s, h, w); | ||
}), w) { | ||
C(v, "needFxCounter") && V("child", c, w.fxCount, s, h, w), C(v, "storeChange") && V("child", c, w.storeChange, s, h, w), C(v, "warnSerialize") && V("child", c, w.warnSerializeNode, s, h, w); | ||
let m = w.additionalLinks[v.id]; | ||
m && L(m, (g) => { | ||
V("child", c, g, s, h, w); | ||
if (!f) { | ||
let m = Q(s), _ = ae(s); | ||
if (L(v.next, (S) => { | ||
V("child", c, S, s, m, _); | ||
}), _) { | ||
C(v, "needFxCounter") && V("child", c, _.fxCount, s, m, _), C(v, "storeChange") && V("child", c, _.storeChange, s, m, _), C(v, "warnSerialize") && V("child", c, _.warnSerializeNode, s, m, _); | ||
let S = _.additionalLinks[v.id]; | ||
S && L(S, (w) => { | ||
V("child", c, w, s, m, _); | ||
}); | ||
@@ -167,19 +173,19 @@ } | ||
function A(e, t) { | ||
let r = re({ or: t, and: typeof e == "string" ? { name: e } : e }), n = (a, ...p) => (ee(!C(n, "derived"), "call of derived event", "createEvent"), ee(!se, "unit call from pure function", "operators like sample"), R ? ((y, v, d, c) => { | ||
let f = R, i = null; | ||
let r = re({ or: t, and: typeof e == "string" ? { name: e } : e }), n = (a, ...f) => (ee(!C(n, "derived"), "call of derived event", "createEvent"), ee(!se, "unit call from pure function", "operators like sample"), R ? ((y, v, p, c) => { | ||
let d = R, i = null; | ||
if (v) | ||
for (i = R; i && i.template !== v; ) | ||
i = W(i); | ||
qe(i); | ||
let u = y.create(d, c); | ||
return qe(f), u; | ||
})(n, o, a, p) : n.create(a, p)), o = st(), l = Object.assign(n, { graphite: x({ meta: vt(r.actualOp || "event", n, r), regional: 1 }), create: (a) => (rt({ target: n, params: a, scope: O }), a), watch: (a) => pt(n, a), map: (a) => _e(n, X, a, [N()]), filter: (a) => _e(n, "filter", a.fn ? a : a.fn, [N(Te, 1)]), filterMap: (a) => _e(n, "filterMap", a, [N(), Be((p) => !I(p), 1)]), prepend(a) { | ||
let p = A("* → " + n.shortName, { parent: W(n) }); | ||
return J("eventPrepend", H(p)), ze(p, n, [N()], "prepend", a), Ft(n, p), p; | ||
Ye(i); | ||
let u = y.create(p, c); | ||
return Ye(d), u; | ||
})(n, o, a, f) : n.create(a, f)), o = st(), l = Object.assign(n, { graphite: x({ meta: vt(r.actualOp || "event", n, r), regional: 1 }), create: (a) => (rt({ target: n, params: a, scope: O }), a), watch: (a) => pt(n, a), map: (a) => ge(n, X, a, [N()]), filter: (a) => ge(n, "filter", a.fn ? a : a.fn, [N(Ie, 1)]), filterMap: (a) => ge(n, "filterMap", a, [N(), Be((f) => !I(f), 1)]), prepend(a) { | ||
let f = A("* → " + n.shortName, { parent: W(n) }); | ||
return J("eventPrepend", H(f)), je(f, n, [N()], "prepend", a), Ft(n, f), f; | ||
} }); | ||
return r != null && r.domain && r.domain.hooks.event(l), Y(l, "id", l.graphite.id), ot(l.graphite), l; | ||
} | ||
function We(e, t, r, n) { | ||
function Fe(e, t, r, n) { | ||
return Ht(r, t, "first argument"), j(T(n), "second argument should be a function"), ee(!C(e, "derived"), `${t} in derived store`, `${t} in store created via createStore`), L(Array.isArray(r) ? r : [r], (o) => { | ||
e.off(o), ue(e).set(o, dt(ht(o, e, "on", Pt, n))); | ||
e.off(o), ue(e).set(o, ft(ht(o, e, "on", Pt, n))); | ||
}), e; | ||
@@ -199,14 +205,14 @@ } | ||
return !i && O && (F(O, n, 1), i = O), i && (u = i.reg[l]), ct(u); | ||
}, setState: (i) => rt({ target: a, params: i, defer: 1, scope: O }), reset: (...i) => (L(i, (u) => We(a, ".reset", u, () => a.defaultState)), a), on: (i, u) => We(a, ".on", i, u), off(i) { | ||
}, setState: (i) => rt({ target: a, params: i, defer: 1, scope: O }), reset: (...i) => (L(i, (u) => Fe(a, ".reset", u, () => a.defaultState)), a), on: (i, u) => Fe(a, ".on", i, u), off(i) { | ||
let u = ue(a).get(i); | ||
return u && (u(), ue(a).delete(i)), a; | ||
}, map(i, u) { | ||
let s, S; | ||
let s, h; | ||
G(i) && (s = i, i = i.fn), ee(I(u), "second argument of store.map", "updateFilter"); | ||
let k = a.getState(); | ||
I(k) || (S = i(k, u)); | ||
let B = nt(S, { name: `${a.shortName} → *`, derived: 1, and: s }), E = ht(a, B, X, Ke, i); | ||
return Nt(le(B), { type: X, fn: i, from: n }), le(B).noInit = 1, J("storeMap", n, E), B; | ||
let B = a.getState(); | ||
I(B) || (h = i(B, u)); | ||
let b = nt(h, { name: `${a.shortName} → *`, derived: 1, and: s }), E = ht(a, b, X, Ue, i); | ||
return Nt(le(b), { type: X, fn: i, from: n }), le(b).noInit = 1, J("storeMap", n, E), b; | ||
}, watch(i, u) { | ||
if (!u || !Pe(i)) { | ||
if (!u || !Ve(i)) { | ||
let s = pt(a, i); | ||
@@ -216,20 +222,20 @@ return J("storeWatch", n, i) || i(a.getState()), s; | ||
return j(T(u), "second argument should be a function"), i.watch((s) => u(a.getState(), s)); | ||
} }, p = vt("store", a, r), y = a.defaultConfig.updateFilter; | ||
a.graphite = x({ scope: { state: n, fn: y }, node: [Be((i, u, s) => (s.scope && !s.scope.reg[n.id] && (s.b = 1), i)), xt(n), Be((i, u, { a: s, b: S }) => !I(i) && (i !== s || S), 1), y && N(Ke, 1), de({ from: Z, target: n })], child: o, meta: { ...p, defaultState: e }, regional: 1 }), Y(a, "id", a.graphite.id), Y(a, "rootStateRefId", l); | ||
let v = C(a, "serialize"), d = C(a, "derived"), c = v === "ignore", f = C(a, "sid"); | ||
return f && (Y(a, "storeChange", 1), n.sid = f), f || c || d || Y(a, "warnSerialize", 1), j(d || !I(e), "current state can't be undefined, use null instead"), lt(a, [o]), r != null && r.domain && r.domain.hooks.store(a), d || (a.reinit = A({ named: "reinit" }), a.reset(a.reinit)), n.meta = a.graphite.meta, ot(a.graphite), a; | ||
} }, f = vt("store", a, r), y = a.defaultConfig.updateFilter; | ||
a.graphite = x({ scope: { state: n, fn: y }, node: [Be((i, u, s) => (s.scope && !s.scope.reg[n.id] && (s.b = 1), i)), xt(n), Be((i, u, { a: s, b: h }) => !I(i) && (i !== s || h), 1), y && N(Ue, 1), fe({ from: Z, target: n })], child: o, meta: { ...f, defaultState: e }, regional: 1 }), Y(a, "id", a.graphite.id), Y(a, "rootStateRefId", l); | ||
let v = C(a, "serialize"), p = C(a, "derived"), c = v === "ignore", d = C(a, "sid"); | ||
return d && (Y(a, "storeChange", 1), n.sid = d), d || c || p || Y(a, "warnSerialize", 1), j(p || !I(e), "current state can't be undefined, use null instead"), lt(a, [o]), r != null && r.domain && r.domain.hooks.store(a), p || (a.reinit = A({ named: "reinit" }), a.reset(a.reinit)), n.meta = a.graphite.meta, ot(a.graphite), a; | ||
} | ||
let bt = typeof Symbol < "u" && Symbol.observable || "@@observable", X = "map", Z = "stack", H = (e) => e.graphite || e, ce = (e) => e.family.owners, fe = (e) => e.family.links, le = (e) => e.stateRef, Q = (e) => e.value, ue = (e) => e.subscribers, W = (e) => e.parent, ae = (e) => e.scope, C = (e, t) => H(e).meta[t], Y = (e, t, r) => H(e).meta[t] = r, kt = (e) => e.compositeName, Pe = (e) => (T(e) || G(e)) && "kind" in e; | ||
const ne = (e) => (t) => Pe(t) && t.kind === e; | ||
let Ve = ne("store"), Bt = ne("event"), Fe = ne("effect"), at = ne("domain"), Ct = ne("scope"); | ||
var At = { __proto__: null, unit: Pe, store: Ve, event: Bt, effect: Fe, domain: at, scope: Ct, attached: (e) => Fe(e) && C(e, "attached") == 1 }; | ||
let ge = (e, t) => { | ||
let bt = typeof Symbol < "u" && Symbol.observable || "@@observable", X = "map", Z = "stack", H = (e) => e.graphite || e, ce = (e) => e.family.owners, de = (e) => e.family.links, le = (e) => e.stateRef, Q = (e) => e.value, ue = (e) => e.subscribers, W = (e) => e.parent, ae = (e) => e.scope, C = (e, t) => H(e).meta[t], Y = (e, t, r) => H(e).meta[t] = r, kt = (e) => e.compositeName, Ve = (e) => (T(e) || G(e)) && "kind" in e; | ||
const ne = (e) => (t) => Ve(t) && t.kind === e; | ||
let xe = ne("store"), Bt = ne("event"), Ge = ne("effect"), at = ne("domain"), Ct = ne("scope"); | ||
var At = { __proto__: null, unit: Ve, store: xe, event: Bt, effect: Ge, domain: at, scope: Ct, attached: (e) => Ge(e) && C(e, "attached") == 1 }; | ||
let we = (e, t) => { | ||
let r = e.indexOf(t); | ||
r !== -1 && e.splice(r, 1); | ||
}, P = (e, t) => e.push(t), ee = (e, t, r) => !e && console.error(`${t} is deprecated${r ? `, use ${r} instead` : ""}`); | ||
const xe = () => { | ||
const Te = () => { | ||
let e = 0; | ||
return () => "" + ++e; | ||
}; | ||
let Lt = xe(), it = xe(), Rt = xe(), z = null, ot = (e) => { | ||
let Lt = Te(), it = Te(), Rt = Te(), z = null, ot = (e) => { | ||
}, st = () => z, Mt = (e) => (e && z && z.sidRoot && (e = `${z.sidRoot}|${e}`), e), lt = (e, t) => { | ||
@@ -239,9 +245,9 @@ let r = H(e); | ||
let o = H(n); | ||
r.family.type !== "domain" && (o.family.type = "crosslink"), P(ce(o), r), P(fe(r), o); | ||
r.family.type !== "domain" && (o.family.type = "crosslink"), P(ce(o), r), P(de(r), o); | ||
}); | ||
}, ie = (e = []) => (Array.isArray(e) ? e : [e]).flat().map(H), G = (e) => typeof e == "object" && e !== null, T = (e) => typeof e == "function", I = (e) => e === void 0, Dt = (e) => j(G(e) || T(e), "expect first argument be an object"); | ||
const Ge = (e, t, r, n) => j(!(!G(e) && !T(e) || !("family" in e) && !("graphite" in e)), `${t}: expect ${r} to be a unit (store, event or effect)${n}`); | ||
const Ke = (e, t, r, n) => j(!(!G(e) && !T(e) || !("family" in e) && !("graphite" in e)), `${t}: expect ${r} to be a unit (store, event or effect)${n}`); | ||
let Ht = (e, t, r) => { | ||
Array.isArray(e) ? L(e, (n, o) => Ge(n, t, `${o} item of ${r}`, "")) : Ge(e, t, r, " or array of units"); | ||
}, Ke = (e, { fn: t }, { a: r }) => t(e, r), Pt = (e, { fn: t }, { a: r }) => t(r, e), Te = (e, { fn: t }) => t(e); | ||
Array.isArray(e) ? L(e, (n, o) => Ke(n, t, `${o} item of ${r}`, "")) : Ke(e, t, r, " or array of units"); | ||
}, Ue = (e, { fn: t }, { a: r }) => t(e, r), Pt = (e, { fn: t }, { a: r }) => t(r, e), Ie = (e, { fn: t }) => t(e); | ||
const ut = (e, t, r, n) => { | ||
@@ -251,6 +257,6 @@ let o = { id: it(), type: e, data: t }; | ||
}; | ||
let Vt = 0, de = ({ from: e = "store", store: t, target: r, to: n = r ? "store" : Z, batch: o, priority: l }) => ut("mov", { from: e, store: t, to: n, target: r }, l, o), te = ({ fn: e, batch: t, priority: r, safe: n = 0, filter: o = 0, pure: l = 0 }) => ut("compute", { fn: e, safe: n, filter: o, pure: l }, r, t), Ie = ({ fn: e }) => te({ fn: e, priority: "effect" }), Be = (e, t, r) => te({ fn: e, safe: 1, filter: t, priority: r && "effect" }), xt = (e, t, r) => de({ store: e, to: t ? Z : "a", priority: r && "sampler", batch: 1 }), N = (e = Te, t) => te({ fn: e, pure: 1, filter: t }), Tt = { mov: de, compute: te, filter: ({ fn: e, pure: t }) => te({ fn: e, filter: 1, pure: t }), run: Ie }, It = (e) => ({ id: it(), current: e }), ct = ({ current: e }) => e, Nt = (e, t) => { | ||
let Vt = 0, fe = ({ from: e = "store", store: t, target: r, to: n = r ? "store" : Z, batch: o, priority: l }) => ut("mov", { from: e, store: t, to: n, target: r }, l, o), te = ({ fn: e, batch: t, priority: r, safe: n = 0, filter: o = 0, pure: l = 0 }) => ut("compute", { fn: e, safe: n, filter: o, pure: l }, r, t), Ne = ({ fn: e }) => te({ fn: e, priority: "effect" }), Be = (e, t, r) => te({ fn: e, safe: 1, filter: t, priority: r && "effect" }), xt = (e, t, r) => fe({ store: e, to: t ? Z : "a", priority: r && "sampler", batch: 1 }), N = (e = Ie, t) => te({ fn: e, pure: 1, filter: t }), Tt = { mov: fe, compute: te, filter: ({ fn: e, pure: t }) => te({ fn: e, filter: 1, pure: t }), run: Ne }, It = (e) => ({ id: it(), current: e }), ct = ({ current: e }) => e, Nt = (e, t) => { | ||
e.before || (e.before = []), P(e.before, t); | ||
}, $ = null; | ||
const Ne = (e, t) => { | ||
const $e = (e, t) => { | ||
if (!e) | ||
@@ -261,10 +267,10 @@ return t; | ||
let r; | ||
return (e.v.type === t.v.type && e.v.id > t.v.id || Ae(e.v.type) > Ae(t.v.type)) && (r = e, e = t, t = r), r = Ne(e.r, t), e.r = e.l, e.l = r, e; | ||
}, $e = []; | ||
let Ue = 0; | ||
for (; Ue < 6; ) | ||
P($e, { first: null, last: null, size: 0 }), Ue += 1; | ||
return (e.v.type === t.v.type && e.v.id > t.v.id || Ae(e.v.type) > Ae(t.v.type)) && (r = e, e = t, t = r), r = $e(e.r, t), e.r = e.l, e.l = r, e; | ||
}, ze = []; | ||
let qe = 0; | ||
for (; qe < 6; ) | ||
P(ze, { first: null, last: null, size: 0 }), qe += 1; | ||
const $t = () => { | ||
for (let e = 0; e < 6; e++) { | ||
let t = $e[e]; | ||
let t = ze[e]; | ||
if (t.size > 0) { | ||
@@ -274,3 +280,3 @@ if (e === 3 || e === 4) { | ||
let n = $.v; | ||
return $ = Ne($.l, $.r), n; | ||
return $ = $e($.l, $.r), n; | ||
} | ||
@@ -283,4 +289,4 @@ t.size === 1 && (t.last = null); | ||
}, V = (e, t, r, n, o, l, a) => Ce(0, { a: null, b: null, node: r, parent: n, value: o, page: t, scope: l, meta: a }, e), Ce = (e, t, r, n = 0) => { | ||
let o = Ae(r), l = $e[o], a = { v: { idx: e, stack: t, type: r, id: n }, l: null, r: null }; | ||
o === 3 || o === 4 ? $ = Ne($, a) : (l.size === 0 ? l.first = a : l.last.r = a, l.last = a), l.size += 1; | ||
let o = Ae(r), l = ze[o], a = { v: { idx: e, stack: t, type: r, id: n }, l: null, r: null }; | ||
o === 3 || o === 4 ? $ = $e($, a) : (l.size === 0 ? l.first = a : l.last.r = a, l.last = a), l.size += 1; | ||
}, Ae = (e) => { | ||
@@ -304,6 +310,6 @@ switch (e) { | ||
}, ye = /* @__PURE__ */ new Set(); | ||
let O, oe = 1, we = 0, se = 0, R = null, qe = (e) => { | ||
let O, oe = 1, _e = 0, se = 0, R = null, Ye = (e) => { | ||
R = e; | ||
}; | ||
const ft = (e, t) => { | ||
const dt = (e, t) => { | ||
if (e) { | ||
@@ -318,3 +324,3 @@ for (; e && !e.reg[t]; ) | ||
let zt = (e, t, r, n, o) => { | ||
let l = ft(e, n.id); | ||
let l = dt(e, n.id); | ||
return l ? l.reg[n.id] : t ? (F(t, n, o), t.reg[n.id]) : n; | ||
@@ -325,12 +331,12 @@ }; | ||
var l; | ||
let a = e.reg, p = t.sid, y = t == null || (l = t.meta) === null || l === void 0 ? void 0 : l.serialize, v = e.fromSerialize && y !== "ignore" && (y == null ? void 0 : y.read) || jt; | ||
let a = e.reg, f = t.sid, y = t == null || (l = t.meta) === null || l === void 0 ? void 0 : l.serialize, v = e.fromSerialize && y !== "ignore" && (y == null ? void 0 : y.read) || jt; | ||
if (a[t.id]) | ||
return; | ||
let d = { id: t.id, current: t.current, meta: t.meta }; | ||
if (d.id in e.values.idMap) | ||
d.current = e.values.idMap[d.id]; | ||
else if (p && p in e.values.sidMap && !(p in e.sidIdMap)) | ||
d.current = v(e.values.sidMap[p]); | ||
let p = { id: t.id, current: t.current, meta: t.meta }; | ||
if (p.id in e.values.idMap) | ||
p.current = e.values.idMap[p.id]; | ||
else if (f && f in e.values.sidMap && !(f in e.sidIdMap)) | ||
p.current = v(e.values.sidMap[f]); | ||
else if (t.before && !o) { | ||
let c = 0, f = r || !t.noInit || n; | ||
let c = 0, d = r || !t.noInit || n; | ||
L(t.before, (i) => { | ||
@@ -343,3 +349,3 @@ switch (i.type) { | ||
let s = u && a[u.id].current; | ||
f && (d.current = i.fn ? i.fn(s) : s); | ||
d && (p.current = i.fn ? i.fn(s) : s); | ||
} | ||
@@ -349,7 +355,7 @@ break; | ||
case "field": | ||
c || (c = 1, d.current = Array.isArray(d.current) ? [...d.current] : { ...d.current }), F(e, i.from, r, n), f && (d.current[i.field] = a[a[i.from.id].id].current); | ||
c || (c = 1, p.current = Array.isArray(p.current) ? [...p.current] : { ...p.current }), F(e, i.from, r, n), d && (p.current[i.field] = a[a[i.from.id].id].current); | ||
} | ||
}); | ||
} | ||
p && (e.sidIdMap[p] = t.id), a[t.id] = d; | ||
f && (e.sidIdMap[f] = t.id), a[t.id] = p; | ||
}; | ||
@@ -366,16 +372,16 @@ const Wt = (e, t, r) => { | ||
}), re(e.and, t)), t); | ||
const Ye = (e, t) => { | ||
ge(e.next, t), ge(ce(e), t), ge(fe(e), t); | ||
const Je = (e, t) => { | ||
we(e.next, t), we(ce(e), t), we(de(e), t); | ||
}, Le = (e, t, r) => { | ||
let n; | ||
e.next.length = 0, e.seq.length = 0, e.scope = null; | ||
let o = fe(e); | ||
let o = de(e); | ||
for (; n = o.pop(); ) | ||
Ye(n, e), (t || r && C(e, "op") !== "sample" || n.family.type === "crosslink") && Le(n, t, C(n, "op") !== "on" && r); | ||
Je(n, e), (t || r && C(e, "op") !== "sample" || n.family.type === "crosslink") && Le(n, t, C(n, "op") !== "on" && r); | ||
for (o = ce(e); n = o.pop(); ) | ||
Ye(n, e), r && n.family.type === "crosslink" && Le(n, t, C(n, "op") !== "on" && r); | ||
Je(n, e), r && n.family.type === "crosslink" && Le(n, t, C(n, "op") !== "on" && r); | ||
}, q = (e) => e.clear(); | ||
let Re = (e, { deep: t } = {}) => { | ||
let r = 0; | ||
if (e.ownerSet && e.ownerSet.delete(e), Ve(e)) | ||
if (e.ownerSet && e.ownerSet.delete(e), xe(e)) | ||
q(ue(e)); | ||
@@ -388,24 +394,24 @@ else if (at(e)) { | ||
Le(H(e), !!t, r); | ||
}, dt = (e) => { | ||
}, ft = (e) => { | ||
let t = () => Re(e); | ||
return t.unsubscribe = t, t; | ||
}, ze = (e, t, r, n, o) => x({ node: r, parent: e, child: t, scope: { fn: o }, meta: { op: n }, family: { owners: [e, t], links: t }, regional: 1 }), pt = (e, t) => (j(T(t), ".watch argument should be a function"), dt(x({ scope: { fn: t }, node: [Ie({ fn: Te })], parent: e, meta: { op: "watch" }, family: { owners: e }, regional: 1 }))), Ft = (e, t, r = "event") => { | ||
}, je = (e, t, r, n, o) => x({ node: r, parent: e, child: t, scope: { fn: o }, meta: { op: n }, family: { owners: [e, t], links: t }, regional: 1 }), pt = (e, t) => (j(T(t), ".watch argument should be a function"), ft(x({ scope: { fn: t }, node: [Ne({ fn: Ie })], parent: e, meta: { op: "watch" }, family: { owners: e }, regional: 1 }))), Ft = (e, t, r = "event") => { | ||
W(e) && W(e).hooks[r](t); | ||
}, vt = (e, t, r) => { | ||
let n = re(r), o = e === "domain", l = Lt(), { sid: a = null, named: p = null, domain: y = null, parent: v = y } = n, d = p || n.name || (o ? "" : l), c = Ot(d, v), f = { op: t.kind = e, name: t.shortName = d, sid: t.sid = Mt(a), named: p, unitId: t.id = l, serialize: n.serialize, derived: n.derived, config: n }; | ||
return t.parent = v, t.compositeName = c, t.defaultConfig = n, t.thru = (i) => (ee(0, "thru", "js pipe"), i(t)), t.getType = () => c.fullName, !o && (t.subscribe = (i) => (Dt(i), t.watch(T(i) ? i : (u) => i.next && i.next(u))), t[bt] = () => t), f; | ||
let n = re(r), o = e === "domain", l = Lt(), { sid: a = null, named: f = null, domain: y = null, parent: v = y } = n, p = f || n.name || (o ? "" : l), c = Ot(p, v), d = { op: t.kind = e, name: t.shortName = p, sid: t.sid = Mt(a), named: f, unitId: t.id = l, serialize: n.serialize, derived: n.derived, config: n }; | ||
return t.parent = v, t.compositeName = c, t.defaultConfig = n, t.thru = (i) => (ee(0, "thru", "js pipe"), i(t)), t.getType = () => c.fullName, !o && (t.subscribe = (i) => (Dt(i), t.watch(T(i) ? i : (u) => i.next && i.next(u))), t[bt] = () => t), d; | ||
}; | ||
const _e = (e, t, r, n) => { | ||
const ge = (e, t, r, n) => { | ||
let o; | ||
G(r) && (o = r, r = r.fn); | ||
let l = A({ name: `${e.shortName} → *`, derived: 1, and: o }); | ||
return ze(e, l, n, t, r), l; | ||
return je(e, l, n, t, r), l; | ||
}, ht = (e, t, r, n, o) => { | ||
let l = le(t), a = de({ store: l, to: "a", priority: "read" }); | ||
let l = le(t), a = fe({ store: l, to: "a", priority: "read" }); | ||
r === X && (a.data.softRead = 1); | ||
let p = [a, N(n)]; | ||
return J("storeOnMap", l, p, Ve(e) && le(e)), ze(e, t, p, r, o); | ||
let f = [a, N(n)]; | ||
return J("storeOnMap", l, f, xe(e) && le(e)), je(e, t, f, r, o); | ||
}; | ||
x({ node: [Ie({ fn: ({ fn: e, value: t }) => e(t) })], meta: { op: "fx", fx: "sidechain" } }); | ||
const Gt = A(), Kt = A(), mt = A(), St = A(), gt = A(), yt = A(), Ut = A(), Me = A(), De = A(), dr = (e) => { | ||
x({ node: [Ne({ fn: ({ fn: e, value: t }) => e(t) })], meta: { op: "fx", fx: "sidechain" } }); | ||
const Gt = A(), Kt = A(), mt = A(), St = A(), wt = A(), yt = A(), Ut = A(), Me = A(), De = A(), fr = (e) => { | ||
e && De({ ...e, isBackHandled: !1 }), (!e || !e.hasOwnProperty("isBackFromBrowser")) && De({ isBackFromBrowser: !1 }), window.history.back(); | ||
@@ -418,4 +424,4 @@ }, pr = (e) => { | ||
M.historyPush({ modal: e }); | ||
}, mr = (e) => { | ||
M.historyPush({ popout: e }); | ||
}, mr = (e, t) => { | ||
M.historyPush({ popout: e }, t); | ||
}, qt = nt({ | ||
@@ -426,2 +432,3 @@ activeView: null, | ||
activePopout: null, | ||
routeOptions: null, | ||
isRouteInit: !1, | ||
@@ -459,5 +466,6 @@ isBackHandled: !0, | ||
activeModal: t | ||
})).on(gt, (e, t) => ({ | ||
})).on(wt, (e, { popout: t, options: r }) => ({ | ||
...e, | ||
activePopout: t | ||
activePopout: t, | ||
routeOptions: r | ||
})).on(yt, (e) => ({ | ||
@@ -487,19 +495,19 @@ ...e, | ||
*/ | ||
var Je; | ||
var Qe; | ||
function Jt() { | ||
if (Je) | ||
if (Qe) | ||
return Oe; | ||
Je = 1; | ||
Qe = 1; | ||
var e = D; | ||
function t(c, f) { | ||
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f; | ||
function t(c, d) { | ||
return c === d && (c !== 0 || 1 / c === 1 / d) || c !== c && d !== d; | ||
} | ||
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, l = e.useLayoutEffect, a = e.useDebugValue; | ||
function p(c, f) { | ||
var i = f(), u = n({ inst: { value: i, getSnapshot: f } }), s = u[0].inst, S = u[1]; | ||
function f(c, d) { | ||
var i = d(), u = n({ inst: { value: i, getSnapshot: d } }), s = u[0].inst, h = u[1]; | ||
return l(function() { | ||
s.value = i, s.getSnapshot = f, y(s) && S({ inst: s }); | ||
}, [c, i, f]), o(function() { | ||
return y(s) && S({ inst: s }), c(function() { | ||
y(s) && S({ inst: s }); | ||
s.value = i, s.getSnapshot = d, y(s) && h({ inst: s }); | ||
}, [c, i, d]), o(function() { | ||
return y(s) && h({ inst: s }), c(function() { | ||
y(s) && h({ inst: s }); | ||
}); | ||
@@ -509,6 +517,6 @@ }, [c]), a(i), i; | ||
function y(c) { | ||
var f = c.getSnapshot; | ||
var d = c.getSnapshot; | ||
c = c.value; | ||
try { | ||
var i = f(); | ||
var i = d(); | ||
return !r(c, i); | ||
@@ -519,7 +527,7 @@ } catch { | ||
} | ||
function v(c, f) { | ||
return f(); | ||
function v(c, d) { | ||
return d(); | ||
} | ||
var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : p; | ||
return Oe.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : d, Oe; | ||
var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : f; | ||
return Oe.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p, Oe; | ||
} | ||
@@ -536,5 +544,5 @@ var be = {}; | ||
*/ | ||
var Qe; | ||
var Xe; | ||
function Qt() { | ||
return Qe || (Qe = 1, process.env.NODE_ENV !== "production" && function() { | ||
return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() { | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); | ||
@@ -544,55 +552,55 @@ var e = D, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
{ | ||
for (var h = arguments.length, w = new Array(h > 1 ? h - 1 : 0), m = 1; m < h; m++) | ||
w[m - 1] = arguments[m]; | ||
n("error", E, w); | ||
for (var m = arguments.length, _ = new Array(m > 1 ? m - 1 : 0), S = 1; S < m; S++) | ||
_[S - 1] = arguments[S]; | ||
n("error", E, _); | ||
} | ||
} | ||
function n(E, h, w) { | ||
function n(E, m, _) { | ||
{ | ||
var m = t.ReactDebugCurrentFrame, g = m.getStackAddendum(); | ||
g !== "" && (h += "%s", w = w.concat([g])); | ||
var _ = w.map(function(b) { | ||
return String(b); | ||
var S = t.ReactDebugCurrentFrame, w = S.getStackAddendum(); | ||
w !== "" && (m += "%s", _ = _.concat([w])); | ||
var g = _.map(function(k) { | ||
return String(k); | ||
}); | ||
_.unshift("Warning: " + h), Function.prototype.apply.call(console[E], console, _); | ||
g.unshift("Warning: " + m), Function.prototype.apply.call(console[E], console, g); | ||
} | ||
} | ||
function o(E, h) { | ||
return E === h && (E !== 0 || 1 / E === 1 / h) || E !== E && h !== h; | ||
function o(E, m) { | ||
return E === m && (E !== 0 || 1 / E === 1 / m) || E !== E && m !== m; | ||
} | ||
var l = typeof Object.is == "function" ? Object.is : o, a = e.useState, p = e.useEffect, y = e.useLayoutEffect, v = e.useDebugValue, d = !1, c = !1; | ||
function f(E, h, w) { | ||
d || e.startTransition !== void 0 && (d = !0, r("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 m = h(); | ||
var l = typeof Object.is == "function" ? Object.is : o, a = e.useState, f = e.useEffect, y = e.useLayoutEffect, v = e.useDebugValue, p = !1, c = !1; | ||
function d(E, m, _) { | ||
p || e.startTransition !== void 0 && (p = !0, r("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 S = m(); | ||
if (!c) { | ||
var g = h(); | ||
l(m, g) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0); | ||
var w = m(); | ||
l(S, w) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0); | ||
} | ||
var _ = a({ | ||
var g = a({ | ||
inst: { | ||
value: m, | ||
getSnapshot: h | ||
value: S, | ||
getSnapshot: m | ||
} | ||
}), b = _[0].inst, K = _[1]; | ||
}), k = g[0].inst, K = g[1]; | ||
return y(function() { | ||
b.value = m, b.getSnapshot = h, i(b) && K({ | ||
inst: b | ||
k.value = S, k.getSnapshot = m, i(k) && K({ | ||
inst: k | ||
}); | ||
}, [E, m, h]), p(function() { | ||
i(b) && K({ | ||
inst: b | ||
}, [E, S, m]), f(function() { | ||
i(k) && K({ | ||
inst: k | ||
}); | ||
var pe = function() { | ||
i(b) && K({ | ||
inst: b | ||
i(k) && K({ | ||
inst: k | ||
}); | ||
}; | ||
return E(pe); | ||
}, [E]), v(m), m; | ||
}, [E]), v(S), S; | ||
} | ||
function i(E) { | ||
var h = E.getSnapshot, w = E.value; | ||
var m = E.getSnapshot, _ = E.value; | ||
try { | ||
var m = h(); | ||
return !l(w, m); | ||
var S = m(); | ||
return !l(_, S); | ||
} catch { | ||
@@ -602,12 +610,12 @@ return !0; | ||
} | ||
function u(E, h, w) { | ||
return h(); | ||
function u(E, m, _) { | ||
return m(); | ||
} | ||
var s = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !s, k = S ? u : f, B = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : k; | ||
be.useSyncExternalStore = B, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
var s = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", h = !s, B = h ? u : d, b = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : B; | ||
be.useSyncExternalStore = b, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
}()), be; | ||
} | ||
process.env.NODE_ENV === "production" ? He.exports = Jt() : He.exports = Qt(); | ||
var je = He.exports; | ||
const Xt = /* @__PURE__ */ Yt(je); | ||
var We = He.exports; | ||
const Xt = /* @__PURE__ */ Yt(We); | ||
/** | ||
@@ -622,13 +630,13 @@ * @license React | ||
*/ | ||
var Xe; | ||
var Ze; | ||
function Zt() { | ||
if (Xe) | ||
if (Ze) | ||
return Ee; | ||
Xe = 1; | ||
var e = D, t = je; | ||
function r(v, d) { | ||
return v === d && (v !== 0 || 1 / v === 1 / d) || v !== v && d !== d; | ||
Ze = 1; | ||
var e = D, t = We; | ||
function r(v, p) { | ||
return v === p && (v !== 0 || 1 / v === 1 / p) || v !== v && p !== p; | ||
} | ||
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, l = e.useRef, a = e.useEffect, p = e.useMemo, y = e.useDebugValue; | ||
return Ee.useSyncExternalStoreWithSelector = function(v, d, c, f, i) { | ||
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, l = e.useRef, a = e.useEffect, f = e.useMemo, y = e.useDebugValue; | ||
return Ee.useSyncExternalStoreWithSelector = function(v, p, c, d, i) { | ||
var u = l(null); | ||
@@ -640,28 +648,28 @@ if (u.current === null) { | ||
s = u.current; | ||
u = p(function() { | ||
function k(m) { | ||
if (!B) { | ||
if (B = !0, E = m, m = f(m), i !== void 0 && s.hasValue) { | ||
var g = s.value; | ||
if (i(g, m)) | ||
return h = g; | ||
u = f(function() { | ||
function B(S) { | ||
if (!b) { | ||
if (b = !0, E = S, S = d(S), i !== void 0 && s.hasValue) { | ||
var w = s.value; | ||
if (i(w, S)) | ||
return m = w; | ||
} | ||
return h = m; | ||
return m = S; | ||
} | ||
if (g = h, n(E, m)) | ||
return g; | ||
var _ = f(m); | ||
return i !== void 0 && i(g, _) ? g : (E = m, h = _); | ||
if (w = m, n(E, S)) | ||
return w; | ||
var g = d(S); | ||
return i !== void 0 && i(w, g) ? w : (E = S, m = g); | ||
} | ||
var B = !1, E, h, w = c === void 0 ? null : c; | ||
var b = !1, E, m, _ = c === void 0 ? null : c; | ||
return [function() { | ||
return k(d()); | ||
}, w === null ? void 0 : function() { | ||
return k(w()); | ||
return B(p()); | ||
}, _ === null ? void 0 : function() { | ||
return B(_()); | ||
}]; | ||
}, [d, c, f, i]); | ||
var S = o(v, u[0], u[1]); | ||
}, [p, c, d, i]); | ||
var h = o(v, u[0], u[1]); | ||
return a(function() { | ||
s.hasValue = !0, s.value = S; | ||
}, [S]), y(S), S; | ||
s.hasValue = !0, s.value = h; | ||
}, [h]), y(h), h; | ||
}, Ee; | ||
@@ -679,44 +687,44 @@ } | ||
*/ | ||
var Ze; | ||
var et; | ||
function er() { | ||
return Ze || (Ze = 1, process.env.NODE_ENV !== "production" && function() { | ||
return et || (et = 1, process.env.NODE_ENV !== "production" && function() { | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); | ||
var e = D, t = je; | ||
function r(d, c) { | ||
return d === c && (d !== 0 || 1 / d === 1 / c) || d !== d && c !== c; | ||
var e = D, t = We; | ||
function r(p, c) { | ||
return p === c && (p !== 0 || 1 / p === 1 / c) || p !== p && c !== c; | ||
} | ||
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, l = e.useRef, a = e.useEffect, p = e.useMemo, y = e.useDebugValue; | ||
function v(d, c, f, i, u) { | ||
var s = l(null), S; | ||
s.current === null ? (S = { | ||
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, l = e.useRef, a = e.useEffect, f = e.useMemo, y = e.useDebugValue; | ||
function v(p, c, d, i, u) { | ||
var s = l(null), h; | ||
s.current === null ? (h = { | ||
hasValue: !1, | ||
value: null | ||
}, s.current = S) : S = s.current; | ||
var k = p(function() { | ||
var w = !1, m, g, _ = function(U) { | ||
if (!w) { | ||
w = !0, m = U; | ||
}, s.current = h) : h = s.current; | ||
var B = f(function() { | ||
var _ = !1, S, w, g = function(U) { | ||
if (!_) { | ||
_ = !0, S = U; | ||
var ve = i(U); | ||
if (u !== void 0 && S.hasValue) { | ||
var he = S.value; | ||
if (u !== void 0 && h.hasValue) { | ||
var he = h.value; | ||
if (u(he, ve)) | ||
return g = he, he; | ||
return w = he, he; | ||
} | ||
return g = ve, ve; | ||
return w = ve, ve; | ||
} | ||
var _t = m, me = g; | ||
if (n(_t, U)) | ||
var gt = S, me = w; | ||
if (n(gt, U)) | ||
return me; | ||
var Se = i(U); | ||
return u !== void 0 && u(me, Se) ? me : (m = U, g = Se, Se); | ||
}, b = f === void 0 ? null : f, K = function() { | ||
return _(c()); | ||
}, pe = b === null ? void 0 : function() { | ||
return _(b()); | ||
return u !== void 0 && u(me, Se) ? me : (S = U, w = Se, Se); | ||
}, k = d === void 0 ? null : d, K = function() { | ||
return g(c()); | ||
}, pe = k === null ? void 0 : function() { | ||
return g(k()); | ||
}; | ||
return [K, pe]; | ||
}, [c, f, i, u]), B = k[0], E = k[1], h = o(d, B, E); | ||
}, [c, d, i, u]), b = B[0], E = B[1], m = o(p, b, E); | ||
return a(function() { | ||
S.hasValue = !0, S.value = h; | ||
}, [h]), y(h), h; | ||
h.hasValue = !0, h.value = m; | ||
}, [m]), y(m), m; | ||
} | ||
@@ -730,4 +738,4 @@ ke.useSyncExternalStoreWithSelector = v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
if (n && o.unshift(n), r) { | ||
let l = x({ node: o }), a = e.graphite.id, p = r.additionalLinks, y = p[a] || []; | ||
return p[a] = y, y.push(l), () => { | ||
let l = x({ node: o }), a = e.graphite.id, f = r.additionalLinks, y = f[a] || []; | ||
return f[a] = y, y.push(l), () => { | ||
let v = y.indexOf(l); | ||
@@ -745,3 +753,3 @@ v !== -1 && y.splice(v, 1), Re(l); | ||
function rr(e, t) { | ||
At.store(e) || wt("expect useStore argument to be a store"); | ||
At.store(e) || _t("expect useStore argument to be a store"); | ||
let r = D.useCallback((o) => tr(e, o, t), [e, t]), n = D.useCallback(() => or(e, t), [e, t]); | ||
@@ -752,3 +760,3 @@ return ir(r, n, n); | ||
let t = D.useContext(sr); | ||
return e && !t && wt("No scope found, consider adding <Provider> to app root"), t; | ||
return e && !t && _t("No scope found, consider adding <Provider> to app root"), t; | ||
} | ||
@@ -758,3 +766,3 @@ function ar(e, t) { | ||
} | ||
let wt = (e) => { | ||
let _t = (e) => { | ||
throw Error(e); | ||
@@ -764,3 +772,3 @@ }; | ||
const { useSyncExternalStore: ir } = Xt, or = (e, t) => t ? t.getState(e) : e.getState(), sr = D.createContext(null), lr = (e, t, r) => { | ||
tt(() => { | ||
Pe(() => { | ||
const n = (o) => { | ||
@@ -771,25 +779,25 @@ o instanceof KeyboardEvent && o.key === r ? t(o) : r || t(o); | ||
}, [e, r, t]); | ||
}, et = (e, t, r, n) => { | ||
tt(() => (M.addEventListener(e, t, r), () => M.removeEventListener(r)), [...n]); | ||
}, tt = (e, t, r, n) => { | ||
Pe(() => (M.addEventListener(e, t, r), () => M.removeEventListener(r)), [...n]); | ||
}, Sr = (e, ...t) => { | ||
const { activeView: r, activePanel: n, activeModal: o, activePopout: l, isRouteInit: a, isDispatchChangeStateEventBeforeMiddleware: p, isDispatchChangeStateEventAfterMiddleware: y, isBackHandled: v, isBackFromBrowser: d, afterBackHandledCallback: c, beforeBackHandledCallback: f } = ur(); | ||
et("init", (i) => { | ||
console.log("[blum]: initialized", i), a || (Me(), M.historyPush(e)); | ||
const { activeView: r, activePanel: n, activeModal: o, activePopout: l, isRouteInit: a, routeOptions: f, isDispatchChangeStateEventBeforeMiddleware: y, isDispatchChangeStateEventAfterMiddleware: v, isBackHandled: p, isBackFromBrowser: c, afterBackHandledCallback: d, beforeBackHandledCallback: i } = ur(); | ||
tt("init", (u) => { | ||
console.log("[blum]: initialized", u), a || (Me(), M.historyPush(e)); | ||
}, 1, [a]), lr("popstate", async () => { | ||
const i = async (u, s) => { | ||
p && M.dispatchChangeStateEvent(); | ||
for (const S in t) | ||
if (!await t[S](u, s, { | ||
isBackHandled: v, | ||
isBackFromBrowser: d, | ||
isDispatchChangeStateEventAfterMiddleware: y, | ||
isDispatchChangeStateEventBeforeMiddleware: p, | ||
beforeBackHandledCallback: f, | ||
afterBackHandledCallback: c | ||
const u = async (s, h) => { | ||
y && M.dispatchChangeStateEvent(); | ||
for (const B in t) | ||
if (!await t[B](s, h, { | ||
isBackHandled: p, | ||
isBackFromBrowser: c, | ||
isDispatchChangeStateEventAfterMiddleware: v, | ||
isDispatchChangeStateEventBeforeMiddleware: y, | ||
beforeBackHandledCallback: i, | ||
afterBackHandledCallback: d | ||
})) | ||
return; | ||
y && M.dispatchChangeStateEvent(); | ||
v && M.dispatchChangeStateEvent(); | ||
}; | ||
if (a) { | ||
const u = window.history.state ?? { | ||
const s = window.history.state ?? { | ||
view: void 0, | ||
@@ -799,3 +807,3 @@ panel: void 0, | ||
popout: void 0 | ||
}, s = { | ||
}, h = { | ||
view: r, | ||
@@ -806,11 +814,13 @@ panel: n, | ||
}; | ||
console.log("[blum]: prevRoutes", u), console.log("[blum]: storeRoutes", s), f && f(s, u), await i(s, u), Me(), c && c(s, u); | ||
console.log("[blum]: prevRoutes", s), console.log("[blum]: storeRoutes", h), i && i(h, s), await u(h, s), Me(), d && d(h, s); | ||
} | ||
}), et("changestate", (i) => { | ||
if (console.log("[blum]: state changed", i), i) { | ||
const { view: u, panel: s, modal: S, popout: k } = i; | ||
u && s && mt({ view: u, panel: s }), St(S), gt(k), a || yt(); | ||
}), tt("changestate", (u) => { | ||
if (console.log("[blum]: state changed", u), u) { | ||
const { view: s, panel: h, modal: B, popout: b } = u; | ||
s && h && mt({ view: s, panel: h }), St(B), wt({ popout: b, options: (u == null ? void 0 : u.options) ?? null }), a || yt(); | ||
} | ||
}, 2, [a]); | ||
}, ur = () => ar(qt), gr = (e) => e, yr = (e, t) => cr(e, async (r, n, o) => { | ||
}, 2, [a]), Pe(() => { | ||
f && f != null && f.afterSetHandledCallback && f.afterSetHandledCallback(); | ||
}, [f]); | ||
}, ur = () => ar(qt), wr = (e) => e, yr = (e, t) => cr(e, async (r, n, o) => { | ||
let l; | ||
@@ -833,9 +843,9 @@ if (t && (l = await t(r, n, o)), M.historyPush(r), typeof l == "boolean") | ||
Kt as _setActivePanel, | ||
gt as _setActivePopout, | ||
wt as _setActivePopout, | ||
Gt as _setActiveView, | ||
dr as back, | ||
fr as back, | ||
M as blumRouter, | ||
cr as createCatchBackBrowserRouteMiddleware, | ||
yr as createDisableBackBrowserRouteMiddleware, | ||
gr as createRouteMiddleware, | ||
wr as createRouteMiddleware, | ||
hr as setActiveModal, | ||
@@ -842,0 +852,0 @@ vr as setActivePanel, |
@@ -1,2 +0,2 @@ | ||
import { BackHandlerOptions } from "src/types"; | ||
import { BackHandlerOptions, SetRouteOptions } from "src/types"; | ||
export declare const back: (options?: BackHandlerOptions) => void; | ||
@@ -9,2 +9,2 @@ export declare const setActiveViewPanel: (routes: { | ||
export declare const setActiveModal: (modal: string) => void; | ||
export declare const setActivePopout: (popout: string) => void; | ||
export declare const setActivePopout: (popout: string, options?: SetRouteOptions) => void; |
@@ -1,2 +0,2 @@ | ||
import { BackHandlerOptions } from "src/types"; | ||
import { BackHandlerOptions, SetRouteOptions } from "src/types"; | ||
export declare const _setActiveView: import("effector").Event<string>; | ||
@@ -9,3 +9,6 @@ export declare const _setActivePanel: import("effector").Event<string>; | ||
export declare const _setActiveModal: import("effector").Event<string | null>; | ||
export declare const _setActivePopout: import("effector").Event<string | null>; | ||
export declare const _setActivePopout: import("effector").Event<{ | ||
popout: string | null; | ||
options: SetRouteOptions | null; | ||
}>; | ||
export declare const initRoute: import("effector").Event<void>; | ||
@@ -12,0 +15,0 @@ export declare const setBackHandled: import("effector").Event<boolean>; |
@@ -1,2 +0,2 @@ | ||
import { Routes } from "src/types"; | ||
import { Routes, SetRouteOptions } from "src/types"; | ||
type Store = { | ||
@@ -8,2 +8,3 @@ activeView: string | null; | ||
isRouteInit: boolean; | ||
routeOptions: SetRouteOptions | null; | ||
isBackHandled: boolean; | ||
@@ -10,0 +11,0 @@ isDispatchChangeStateEventBeforeMiddleware: boolean; |
@@ -28,1 +28,4 @@ export type InitRouteOptions = { | ||
}; | ||
export type SetRouteOptions = { | ||
afterSetHandledCallback?: (() => void) | null; | ||
}; |
@@ -9,2 +9,3 @@ import { BackHandlerOptions, InitRouteOptions, RouteMiddleware, Routes } from "./types"; | ||
isRouteInit: boolean; | ||
routeOptions: import("./types").SetRouteOptions | null; | ||
isBackHandled: boolean; | ||
@@ -11,0 +12,0 @@ isDispatchChangeStateEventBeforeMiddleware: boolean; |
{ | ||
"name": "@blumjs/router", | ||
"version": "7.9.4", | ||
"version": "7.10.0", | ||
"description": "Роутер для vk-mini-apps", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
68093
1070