@blumjs/router
Advanced tools
Comparing version 6.3.0 to 6.3.1
@@ -1,3 +0,3 @@ | ||
import P, { useEffect as tt } from "react"; | ||
const M = { | ||
import P, { useEffect as et } from "react"; | ||
const J = { | ||
subscribers: [], | ||
@@ -14,3 +14,3 @@ back() { | ||
}; | ||
console.log("try to push history", M.subscribers), M.changeState({ | ||
console.log("try to push history", this.subscribers), this.changeState({ | ||
view: e.hasOwnProperty("view") ? e.view : t, | ||
@@ -41,3 +41,3 @@ panel: e.hasOwnProperty("panel") ? e.panel : r, | ||
} | ||
}, rt = M.historyPush, pr = M.back, ue = { | ||
}, tt = J.historyPush, pr = J.back, wt = { | ||
subscribers: [], | ||
@@ -54,3 +54,3 @@ back() { | ||
}; | ||
console.log("try to push history", ue.subscribers), ue.changeState({ | ||
console.log("try to push history", this.subscribers), this.changeState({ | ||
view: e.hasOwnProperty("view") ? e.view : t, | ||
@@ -81,12 +81,10 @@ panel: e.hasOwnProperty("panel") ? e.panel : r, | ||
} | ||
}, fe = ue.historyPush; | ||
ue.back; | ||
const vr = (e) => { | ||
fe({ view: e.view, panel: e.panel }); | ||
}, ce = wt.historyPush, vr = (e) => { | ||
ce({ view: e.view, panel: e.panel }); | ||
}, hr = (e) => { | ||
fe({ panel: e }); | ||
ce({ panel: e }); | ||
}, mr = (e) => { | ||
fe({ modal: e }); | ||
ce({ modal: e }); | ||
}, Sr = (e) => { | ||
fe({ popout: e }); | ||
ce({ popout: e }); | ||
}; | ||
@@ -97,16 +95,16 @@ function Et(e, t) { | ||
} | ||
function A(e, t) { | ||
function k(e, t) { | ||
e.forEach(t); | ||
} | ||
function j(e, t) { | ||
function W(e, t) { | ||
if (!e) | ||
throw Error(t); | ||
} | ||
function B({ node: e = [], from: t, source: r, parent: n = t || r, to: i, target: s, child: o = i || s, scope: p = {}, meta: g = {}, family: c = { type: "regular" }, regional: S } = {}) { | ||
function M({ node: e = [], from: t, source: r, parent: n = t || r, to: i, target: s, child: o = i || s, scope: p = {}, meta: g = {}, family: c = { type: "regular" }, regional: S } = {}) { | ||
let l = ie(n), d = ie(c.links), f = ie(c.owners), a = []; | ||
A(e, (v) => v && T(a, v)); | ||
k(e, (v) => v && T(a, v)); | ||
let u = { id: Vt(), seq: a, next: ie(o), meta: g, scope: p, family: { type: c.type || "crosslink", links: d, owners: f } }; | ||
return A(d, (v) => T(de(v), u)), A(f, (v) => T(pe(v), u)), A(l, (v) => T(v.next, u)), S && W && ut(J(W), [u]), u; | ||
return k(d, (v) => T(fe(v), u)), k(f, (v) => T(de(v), u)), k(l, (v) => T(v.next, u)), S && z && st(Y(z), [u]), u; | ||
} | ||
function nt(e, t, r) { | ||
function rt(e, t, r) { | ||
let n, i = V, s = null, o = O; | ||
@@ -120,3 +118,3 @@ if (e.target && (t = e.params, r = e.defer, n = e.meta, i = "page" in e ? e.page : i, e.stack && (s = e.stack), o = oe(e) || o, e = e.target), o && O && o !== O && (O = null), Array.isArray(e)) | ||
return; | ||
let p, g, c, S, l, d, f = { isRoot: ae, currentPage: V, scope: O, isWatch: Ee, isPure: se }; | ||
let p, g, c, S, l, d, f = { isRoot: ae, currentPage: V, scope: O, isWatch: we, isPure: se }; | ||
ae = 0; | ||
@@ -127,3 +125,3 @@ e: | ||
c = u.node, V = l = u.page, O = oe(u), l ? d = l.reg : O && (d = O.reg); | ||
let L = !!l, k = !!O, w = { fail: 0, scope: c.scope }; | ||
let L = !!l, A = !!O, w = { fail: 0, scope: c.scope }; | ||
p = g = 0; | ||
@@ -135,6 +133,6 @@ for (let h = a; h < c.seq.length && !p; h++) { | ||
if (h !== a || v !== m) { | ||
y ? we.has(E) || (we.add(E), xe(h, u, m, y)) : xe(h, u, m); | ||
y ? _e.has(E) || (_e.add(E), ke(h, u, m, y)) : ke(h, u, m); | ||
continue e; | ||
} | ||
y && we.delete(E); | ||
y && _e.delete(E); | ||
} | ||
@@ -146,3 +144,3 @@ switch (_.type) { | ||
case X: | ||
y = J(u); | ||
y = Y(u); | ||
break; | ||
@@ -159,7 +157,7 @@ case "a": | ||
if (L) { | ||
let b = ft(l, E.store.id); | ||
u.page = l = b, b ? d = b.reg : k ? (H(O, E.store, 0, 1, E.softRead), d = O.reg) : d = void 0; | ||
let b = ct(l, E.store.id); | ||
u.page = l = b, b ? d = b.reg : A ? (G(O, E.store, 0, 1, E.softRead), d = O.reg) : d = void 0; | ||
} else | ||
k && H(O, E.store, 0, 1, E.softRead); | ||
y = ct(d && d[E.store.id] || E.store); | ||
A && G(O, E.store, 0, 1, E.softRead); | ||
y = lt(d && d[E.store.id] || E.store); | ||
} | ||
@@ -182,5 +180,5 @@ switch (E.to) { | ||
if (m.fn) { | ||
Ee = R(c, "op") === "watch", se = m.pure; | ||
let y = m.safe ? (0, m.fn)(J(u), w.scope, u) : Gt(w, m.fn, u); | ||
m.filter ? g = !y : u.value = y, Ee = f.isWatch, se = f.isPure; | ||
we = R(c, "op") === "watch", se = m.pure; | ||
let y = m.safe ? (0, m.fn)(Y(u), w.scope, u) : Gt(w, m.fn, u); | ||
m.filter ? g = !y : u.value = y, we = f.isWatch, se = f.isPure; | ||
} | ||
@@ -191,4 +189,4 @@ } | ||
if (!p) { | ||
let h = J(u), _ = oe(u); | ||
if (A(c.next, (m) => { | ||
let h = Y(u), _ = oe(u); | ||
if (k(c.next, (m) => { | ||
D("child", l, m, u, h, _); | ||
@@ -198,3 +196,3 @@ }), _) { | ||
let m = _.additionalLinks[c.id]; | ||
m && A(m, (y) => { | ||
m && k(m, (y) => { | ||
D("child", l, y, u, h, _); | ||
@@ -216,4 +214,4 @@ }); | ||
} | ||
function Y(e, ...t) { | ||
let r = st(); | ||
function F(e, ...t) { | ||
let r = at(); | ||
if (r) { | ||
@@ -230,20 +228,20 @@ let n = r.handlers[e]; | ||
for (f = V; f && f.template !== c; ) | ||
f = G(f); | ||
qe(f); | ||
f = j(f); | ||
Ue(f); | ||
let a = g.create(S, l); | ||
return qe(d), a; | ||
})(n, i, o, p) : n.create(o, p)), i = st(), s = Object.assign(n, { graphite: B({ meta: vt("event", n, r), regional: 1 }), create: (o) => (nt({ target: n, params: o, scope: O }), o), watch: (o) => pt(n, o), map: (o) => Oe(n, Q, o, [N()]), filter: (o) => Oe(n, "filter", o.fn ? o : o.fn, [N(Be, 1)]), filterMap: (o) => Oe(n, "filterMap", o, [N(), Ae((p) => !$(p), 1)]), prepend(o) { | ||
let p = x("* → " + n.shortName, { parent: G(n) }); | ||
return Y("eventPrepend", C(p)), ze(p, n, [N()], "prepend", o), Ht(n, p), p; | ||
return Ue(d), a; | ||
})(n, i, o, p) : n.create(o, p)), i = at(), s = Object.assign(n, { graphite: M({ meta: pt("event", n, r), regional: 1 }), create: (o) => (rt({ target: n, params: o, scope: O }), o), watch: (o) => dt(n, o), map: (o) => Ee(n, Q, o, [$()]), filter: (o) => Ee(n, "filter", o.fn ? o : o.fn, [$(Me, 1)]), filterMap: (o) => Ee(n, "filterMap", o, [$(), Ae((p) => !I(p), 1)]), prepend(o) { | ||
let p = x("* → " + n.shortName, { parent: j(n) }); | ||
return F("eventPrepend", C(p)), Ne(p, n, [$()], "prepend", o), Ht(n, p), p; | ||
} }); | ||
return r != null && r.domain && r.domain.hooks.event(s), s; | ||
} | ||
function We(e, t, r, n) { | ||
return Tt(r, t, "first argument"), j(I(n), "second argument should be a function"), Z(!R(e, "derived"), `${t} in derived store`, `${t} in store created via createStore`), A(Array.isArray(r) ? r : [r], (i) => { | ||
e.off(i), ce(e).set(i, dt(ht(i, e, "on", Dt, n))); | ||
function ze(e, t, r, n) { | ||
return Tt(r, t, "first argument"), W(B(n), "second argument should be a function"), Z(!R(e, "derived"), `${t} in derived store`, `${t} in store created via createStore`), k(Array.isArray(r) ? r : [r], (i) => { | ||
e.off(i), le(e).set(i, ft(vt(i, e, "on", Dt, n))); | ||
}), e; | ||
} | ||
function ot(e, t) { | ||
function nt(e, t) { | ||
let r = te(t), n = $t(e), i = x({ named: "updates", derived: 1 }); | ||
Y("storeBase", n); | ||
F("storeBase", n); | ||
let s = n.id, o = { subscribers: /* @__PURE__ */ new Map(), updates: i, defaultState: e, stateRef: n, getState() { | ||
@@ -254,58 +252,58 @@ let a, u = n; | ||
for (; v && !v.reg[s]; ) | ||
v = G(v); | ||
v = j(v); | ||
v && (a = v); | ||
} | ||
return !a && O && (H(O, n, 1), a = O), a && (u = a.reg[s]), ct(u); | ||
}, setState: (a) => nt({ target: o, params: a, defer: 1, scope: O }), reset: (...a) => (A(a, (u) => We(o, ".reset", u, () => o.defaultState)), o), on: (a, u) => We(o, ".on", a, u), off(a) { | ||
let u = ce(o).get(a); | ||
return u && (u(), ce(o).delete(a)), o; | ||
return !a && O && (G(O, n, 1), a = O), a && (u = a.reg[s]), lt(u); | ||
}, setState: (a) => rt({ target: o, params: a, defer: 1, scope: O }), reset: (...a) => (k(a, (u) => ze(o, ".reset", u, () => o.defaultState)), o), on: (a, u) => ze(o, ".on", a, u), off(a) { | ||
let u = le(o).get(a); | ||
return u && (u(), le(o).delete(a)), o; | ||
}, map(a, u) { | ||
let v, L; | ||
K(a) && (v = a, a = a.fn), Z($(u), "second argument of store.map", "updateFilter"); | ||
let k = o.getState(); | ||
$(k) || (L = a(k, u)); | ||
let w = ot(L, { name: `${o.shortName} → *`, derived: 1, and: v }), h = ht(o, w, Q, Ke, a); | ||
return Nt(le(w), { type: Q, fn: a, from: n }), le(w).noInit = 1, Y("storeMap", n, h), w; | ||
H(a) && (v = a, a = a.fn), Z(I(u), "second argument of store.map", "updateFilter"); | ||
let A = o.getState(); | ||
I(A) || (L = a(A, u)); | ||
let w = nt(L, { name: `${o.shortName} → *`, derived: 1, and: v }), h = vt(o, w, Q, He, a); | ||
return Nt(ue(w), { type: Q, fn: a, from: n }), ue(w).noInit = 1, F("storeMap", n, h), w; | ||
}, watch(a, u) { | ||
if (!u || !Te(a)) { | ||
let v = pt(o, a); | ||
return Y("storeWatch", n, a) || a(o.getState()), v; | ||
if (!u || !Ce(a)) { | ||
let v = dt(o, a); | ||
return F("storeWatch", n, a) || a(o.getState()), v; | ||
} | ||
return j(I(u), "second argument should be a function"), a.watch((v) => u(o.getState(), v)); | ||
} }, p = vt("store", o, r), g = o.defaultConfig.updateFilter; | ||
o.graphite = B({ scope: { state: n, fn: g }, node: [Ae((a, u, v) => (v.scope && !v.scope.reg[n.id] && (v.b = 1), a)), Bt(n), Ae((a, u, { a: v, b: L }) => !$(a) && (a !== v || L), 1), g && N(Ke, 1), ve({ from: X, target: n })], child: i, meta: p, regional: 1 }); | ||
return W(B(u), "second argument should be a function"), a.watch((v) => u(o.getState(), v)); | ||
} }, p = pt("store", o, r), g = o.defaultConfig.updateFilter; | ||
o.graphite = M({ scope: { state: n, fn: g }, node: [Ae((a, u, v) => (v.scope && !v.scope.reg[n.id] && (v.b = 1), a)), Bt(n), Ae((a, u, { a: v, b: L }) => !I(a) && (a !== v || L), 1), g && $(He, 1), pe({ from: X, target: n })], child: i, meta: p, regional: 1 }); | ||
let c = R(o, "serialize"), S = R(o, "derived"), l = c === "ignore", d = !c || l ? 0 : c, f = R(o, "sid"); | ||
return f && (l || je(o, "storeChange", 1), n.sid = f, d && (n.meta = { ...n == null ? void 0 : n.meta, serialize: d })), f || l || S || je(o, "warnSerialize", 1), j(S || !$(e), "current state can't be undefined, use null instead"), ut(o, [i]), r != null && r.domain && r.domain.hooks.store(o), S || (o.reinit = x(), o.reset(o.reinit)), o; | ||
return f && (l || We(o, "storeChange", 1), n.sid = f, d && (n.meta = { ...n == null ? void 0 : n.meta, serialize: d })), f || l || S || We(o, "warnSerialize", 1), W(S || !I(e), "current state can't be undefined, use null instead"), st(o, [i]), r != null && r.domain && r.domain.hooks.store(o), S || (o.reinit = x(), o.reset(o.reinit)), o; | ||
} | ||
let bt = typeof Symbol < "u" && Symbol.observable || "@@observable", Q = "map", X = "stack", C = (e) => e.graphite || e, de = (e) => e.family.owners, pe = (e) => e.family.links, le = (e) => e.stateRef, J = (e) => e.value, ce = (e) => e.subscribers, G = (e) => e.parent, oe = (e) => e.scope, R = (e, t) => C(e).meta[t], je = (e, t, r) => C(e).meta[t] = r, Lt = (e) => e.compositeName, Te = (e) => (I(e) || K(e)) && "kind" in e; | ||
const ne = (e) => (t) => Te(t) && t.kind === e; | ||
let De = ne("store"), Rt = ne("event"), Ge = ne("effect"), it = ne("domain"), kt = ne("scope"); | ||
var At = { __proto__: null, unit: Te, store: De, event: Rt, effect: Ge, domain: it, scope: kt, attached: (e) => Ge(e) && R(e, "attached") == 1 }; | ||
let _e = (e, t) => { | ||
let bt = typeof Symbol < "u" && Symbol.observable || "@@observable", Q = "map", X = "stack", C = (e) => e.graphite || e, fe = (e) => e.family.owners, de = (e) => e.family.links, ue = (e) => e.stateRef, Y = (e) => e.value, le = (e) => e.subscribers, j = (e) => e.parent, oe = (e) => e.scope, R = (e, t) => C(e).meta[t], We = (e, t, r) => C(e).meta[t] = r, Lt = (e) => e.compositeName, Ce = (e) => (B(e) || H(e)) && "kind" in e; | ||
const ne = (e) => (t) => Ce(t) && t.kind === e; | ||
let Te = ne("store"), Rt = ne("event"), je = ne("effect"), ot = ne("domain"), At = ne("scope"); | ||
var kt = { __proto__: null, unit: Ce, store: Te, event: Rt, effect: je, domain: ot, scope: At, attached: (e) => je(e) && R(e, "attached") == 1 }; | ||
let ye = (e, t) => { | ||
let r = e.indexOf(t); | ||
r !== -1 && e.splice(r, 1); | ||
}, T = (e, t) => e.push(t), Z = (e, t, r) => !e && console.error(`${t} is deprecated${r ? `, use ${r} instead` : ""}`); | ||
const Me = () => { | ||
const De = () => { | ||
let e = 0; | ||
return () => "" + ++e; | ||
}; | ||
let xt = Me(), at = Me(), Vt = Me(), W = null, st = () => W, Pt = (e) => (e && W && W.sidRoot && (e = `${W.sidRoot}|${e}`), e), ut = (e, t) => { | ||
let xt = De(), it = De(), Vt = De(), z = null, at = () => z, Pt = (e) => (e && z && z.sidRoot && (e = `${z.sidRoot}|${e}`), e), st = (e, t) => { | ||
let r = C(e); | ||
A(t, (n) => { | ||
k(t, (n) => { | ||
let i = C(n); | ||
r.family.type !== "domain" && (i.family.type = "crosslink"), T(de(i), r), T(pe(r), i); | ||
r.family.type !== "domain" && (i.family.type = "crosslink"), T(fe(i), r), T(de(r), i); | ||
}); | ||
}, ie = (e = []) => (Array.isArray(e) ? e : [e]).flat().map(C), K = (e) => typeof e == "object" && e !== null, I = (e) => typeof e == "function", $ = (e) => e === void 0, Ct = (e) => j(K(e) || I(e), "expect first argument be an object"); | ||
const He = (e, t, r, n) => j(!(!K(e) && !I(e) || !("family" in e) && !("graphite" in e)), `${t}: expect ${r} to be a unit (store, event or effect)${n}`); | ||
}, ie = (e = []) => (Array.isArray(e) ? e : [e]).flat().map(C), H = (e) => typeof e == "object" && e !== null, B = (e) => typeof e == "function", I = (e) => e === void 0, Ct = (e) => W(H(e) || B(e), "expect first argument be an object"); | ||
const Ge = (e, t, r, n) => W(!(!H(e) && !B(e) || !("family" in e) && !("graphite" in e)), `${t}: expect ${r} to be a unit (store, event or effect)${n}`); | ||
let Tt = (e, t, r) => { | ||
Array.isArray(e) ? A(e, (n, i) => He(n, t, `${i} item of ${r}`, "")) : He(e, t, r, " or array of units"); | ||
}, Ke = (e, { fn: t }, { a: r }) => t(e, r), Dt = (e, { fn: t }, { a: r }) => t(r, e), Be = (e, { fn: t }) => t(e); | ||
const lt = (e, t, r, n) => { | ||
let i = { id: at(), type: e, data: t }; | ||
Array.isArray(e) ? k(e, (n, i) => Ge(n, t, `${i} item of ${r}`, "")) : Ge(e, t, r, " or array of units"); | ||
}, He = (e, { fn: t }, { a: r }) => t(e, r), Dt = (e, { fn: t }, { a: r }) => t(r, e), Me = (e, { fn: t }) => t(e); | ||
const ut = (e, t, r, n) => { | ||
let i = { id: it(), type: e, data: t }; | ||
return r && (i.order = { priority: r }, n && (i.order.barrierID = ++Mt)), i; | ||
}; | ||
let Mt = 0, ve = ({ from: e = "store", store: t, target: r, to: n = r ? "store" : X, batch: i, priority: s }) => lt("mov", { from: e, store: t, to: n, target: r }, s, i), ee = ({ fn: e, batch: t, priority: r, safe: n = 0, filter: i = 0, pure: s = 0 }) => lt("compute", { fn: e, safe: n, filter: i, pure: s }, r, t), Ie = ({ fn: e }) => ee({ fn: e, priority: "effect" }), Ae = (e, t, r) => ee({ fn: e, safe: 1, filter: t, priority: r && "effect" }), Bt = (e, t, r) => ve({ store: e, to: t ? X : "a", priority: r && "sampler", batch: 1 }), N = (e = Be, t) => ee({ fn: e, pure: 1, filter: t }), It = { mov: ve, compute: ee, filter: ({ fn: e, pure: t }) => ee({ fn: e, filter: 1, pure: t }), run: Ie }, $t = (e) => ({ id: at(), current: e }), ct = ({ current: e }) => e, Nt = (e, t) => { | ||
let Mt = 0, pe = ({ from: e = "store", store: t, target: r, to: n = r ? "store" : X, batch: i, priority: s }) => ut("mov", { from: e, store: t, to: n, target: r }, s, i), ee = ({ fn: e, batch: t, priority: r, safe: n = 0, filter: i = 0, pure: s = 0 }) => ut("compute", { fn: e, safe: n, filter: i, pure: s }, r, t), Be = ({ fn: e }) => ee({ fn: e, priority: "effect" }), Ae = (e, t, r) => ee({ fn: e, safe: 1, filter: t, priority: r && "effect" }), Bt = (e, t, r) => pe({ store: e, to: t ? X : "a", priority: r && "sampler", batch: 1 }), $ = (e = Me, t) => ee({ fn: e, pure: 1, filter: t }), It = { mov: pe, compute: ee, filter: ({ fn: e, pure: t }) => ee({ fn: e, filter: 1, pure: t }), run: Be }, $t = (e) => ({ id: it(), current: e }), lt = ({ current: e }) => e, Nt = (e, t) => { | ||
e.before || (e.before = []), T(e.before, t); | ||
}, z = null; | ||
const $e = (e, t) => { | ||
}, N = null; | ||
const Ie = (e, t) => { | ||
if (!e) | ||
@@ -316,15 +314,15 @@ return t; | ||
let r; | ||
return (e.v.type === t.v.type && e.v.id > t.v.id || Ve(e.v.type) > Ve(t.v.type)) && (r = e, e = t, t = r), r = $e(e.r, t), e.r = e.l, e.l = r, e; | ||
}, Ne = []; | ||
let Ue = 0; | ||
for (; Ue < 6; ) | ||
T(Ne, { first: null, last: null, size: 0 }), Ue += 1; | ||
return (e.v.type === t.v.type && e.v.id > t.v.id || xe(e.v.type) > xe(t.v.type)) && (r = e, e = t, t = r), r = Ie(e.r, t), e.r = e.l, e.l = r, e; | ||
}, $e = []; | ||
let Ke = 0; | ||
for (; Ke < 6; ) | ||
T($e, { first: null, last: null, size: 0 }), Ke += 1; | ||
const zt = () => { | ||
for (let e = 0; e < 6; e++) { | ||
let t = Ne[e]; | ||
let t = $e[e]; | ||
if (t.size > 0) { | ||
if (e === 3 || e === 4) { | ||
t.size -= 1; | ||
let n = z.v; | ||
return z = $e(z.l, z.r), n; | ||
let n = N.v; | ||
return N = Ie(N.l, N.r), n; | ||
} | ||
@@ -336,6 +334,6 @@ t.size === 1 && (t.last = null); | ||
} | ||
}, D = (e, t, r, n, i, s, o) => xe(0, { a: null, b: null, node: r, parent: n, value: i, page: t, scope: s, meta: o }, e), xe = (e, t, r, n = 0) => { | ||
let i = Ve(r), s = Ne[i], o = { v: { idx: e, stack: t, type: r, id: n }, l: null, r: null }; | ||
i === 3 || i === 4 ? z = $e(z, o) : (s.size === 0 ? s.first = o : s.last.r = o, s.last = o), s.size += 1; | ||
}, Ve = (e) => { | ||
}, D = (e, t, r, n, i, s, o) => ke(0, { a: null, b: null, node: r, parent: n, value: i, page: t, scope: s, meta: o }, e), ke = (e, t, r, n = 0) => { | ||
let i = xe(r), s = $e[i], o = { v: { idx: e, stack: t, type: r, id: n }, l: null, r: null }; | ||
i === 3 || i === 4 ? N = Ie(N, o) : (s.size === 0 ? s.first = o : s.last.r = o, s.last = o), s.size += 1; | ||
}, xe = (e) => { | ||
switch (e) { | ||
@@ -357,10 +355,10 @@ case "child": | ||
} | ||
}, we = /* @__PURE__ */ new Set(); | ||
let O, ae = 1, Ee = 0, se = 0, V = null, qe = (e) => { | ||
}, _e = /* @__PURE__ */ new Set(); | ||
let O, ae = 1, we = 0, se = 0, V = null, Ue = (e) => { | ||
V = e; | ||
}; | ||
const ft = (e, t) => { | ||
const ct = (e, t) => { | ||
if (e) { | ||
for (; e && !e.reg[t]; ) | ||
e = G(e); | ||
e = j(e); | ||
if (e) | ||
@@ -372,7 +370,7 @@ return e; | ||
let Wt = (e, t, r, n, i) => { | ||
let s = ft(e, n.id); | ||
return s ? s.reg[n.id] : t ? (H(t, n, i), t.reg[n.id]) : n; | ||
let s = ct(e, n.id); | ||
return s ? s.reg[n.id] : t ? (G(t, n, i), t.reg[n.id]) : n; | ||
}; | ||
const jt = (e) => e; | ||
let H = (e, t, r, n, i) => { | ||
let G = (e, t, r, n, i) => { | ||
var s; | ||
@@ -387,3 +385,3 @@ let o = e.reg, p = t.sid, g = t == null || (s = t.meta) === null || s === void 0 ? void 0 : s.serialize; | ||
let S = 0, l = r || !t.noInit || n; | ||
A(t.before, (d) => { | ||
k(t.before, (d) => { | ||
switch (d.type) { | ||
@@ -393,3 +391,3 @@ case Q: { | ||
if (f || d.fn) { | ||
f && H(e, f, r, n); | ||
f && G(e, f, r, n); | ||
let a = f && o[f.id].current; | ||
@@ -401,3 +399,3 @@ l && (c.current = d.fn ? d.fn(a) : a); | ||
case "field": | ||
S || (S = 1, c.current = Array.isArray(c.current) ? [...c.current] : { ...c.current }), H(e, d.from, r, n), l && (c.current[d.field] = o[o[d.from.id].id].current); | ||
S || (S = 1, c.current = Array.isArray(c.current) ? [...c.current] : { ...c.current }), G(e, d.from, r, n), l && (c.current[d.field] = o[o[d.from.id].id].current); | ||
} | ||
@@ -410,3 +408,3 @@ }); | ||
try { | ||
return t(J(r), e.scope, r); | ||
return t(Y(r), e.scope, r); | ||
} catch (n) { | ||
@@ -416,48 +414,48 @@ console.error(n), e.fail = 1; | ||
}; | ||
let te = (e, t = {}) => (K(e) && (te(e.or, t), Et(e, (r, n) => { | ||
$(r) || n === "or" || n === "and" || (t[n] = r); | ||
let te = (e, t = {}) => (H(e) && (te(e.or, t), Et(e, (r, n) => { | ||
I(r) || n === "or" || n === "and" || (t[n] = r); | ||
}), te(e.and, t)), t); | ||
const Fe = (e, t) => { | ||
_e(e.next, t), _e(de(e), t), _e(pe(e), t); | ||
}, Pe = (e, t, r) => { | ||
const qe = (e, t) => { | ||
ye(e.next, t), ye(fe(e), t), ye(de(e), t); | ||
}, Ve = (e, t, r) => { | ||
let n; | ||
e.next.length = 0, e.seq.length = 0, e.scope = null; | ||
let i = pe(e); | ||
let i = de(e); | ||
for (; n = i.pop(); ) | ||
Fe(n, e), (t || r && R(e, "op") !== "sample" || n.family.type === "crosslink") && Pe(n, t, R(n, "op") !== "on" && r); | ||
for (i = de(e); n = i.pop(); ) | ||
Fe(n, e), r && n.family.type === "crosslink" && Pe(n, t, R(n, "op") !== "on" && r); | ||
}, F = (e) => e.clear(); | ||
let Ce = (e, { deep: t } = {}) => { | ||
qe(n, e), (t || r && R(e, "op") !== "sample" || n.family.type === "crosslink") && Ve(n, t, R(n, "op") !== "on" && r); | ||
for (i = fe(e); n = i.pop(); ) | ||
qe(n, e), r && n.family.type === "crosslink" && Ve(n, t, R(n, "op") !== "on" && r); | ||
}, q = (e) => e.clear(); | ||
let Pe = (e, { deep: t } = {}) => { | ||
let r = 0; | ||
if (e.ownerSet && e.ownerSet.delete(e), De(e)) | ||
F(ce(e)); | ||
else if (it(e)) { | ||
if (e.ownerSet && e.ownerSet.delete(e), Te(e)) | ||
q(le(e)); | ||
else if (ot(e)) { | ||
r = 1; | ||
let n = e.history; | ||
F(n.events), F(n.effects), F(n.stores), F(n.domains); | ||
q(n.events), q(n.effects), q(n.stores), q(n.domains); | ||
} | ||
Pe(C(e), !!t, r); | ||
}, dt = (e) => { | ||
let t = () => Ce(e); | ||
Ve(C(e), !!t, r); | ||
}, ft = (e) => { | ||
let t = () => Pe(e); | ||
return t.unsubscribe = t, t; | ||
}, ze = (e, t, r, n, i) => B({ node: r, parent: e, child: t, scope: { fn: i }, meta: { op: n }, family: { owners: [e, t], links: t }, regional: 1 }), pt = (e, t) => (j(I(t), ".watch argument should be a function"), dt(B({ scope: { fn: t }, node: [Ie({ fn: Be })], parent: e, meta: { op: "watch" }, family: { owners: e }, regional: 1 }))), Ht = (e, t, r = "event") => { | ||
G(e) && G(e).hooks[r](t); | ||
}, vt = (e, t, r) => { | ||
}, Ne = (e, t, r, n, i) => M({ node: r, parent: e, child: t, scope: { fn: i }, meta: { op: n }, family: { owners: [e, t], links: t }, regional: 1 }), dt = (e, t) => (W(B(t), ".watch argument should be a function"), ft(M({ scope: { fn: t }, node: [Be({ fn: Me })], parent: e, meta: { op: "watch" }, family: { owners: e }, regional: 1 }))), Ht = (e, t, r = "event") => { | ||
j(e) && j(e).hooks[r](t); | ||
}, pt = (e, t, r) => { | ||
let n = te(r), i = e === "domain", s = xt(), { sid: o = null, named: p = null, domain: g = null, parent: c = g } = n, S = p || n.name || (i ? "" : s), l = Ot(S, c), d = { op: t.kind = e, name: t.shortName = S, sid: t.sid = Pt(o), named: p, unitId: t.id = s, serialize: n.serialize, derived: n.derived, config: n }; | ||
return t.parent = c, t.compositeName = l, t.defaultConfig = n, t.thru = (f) => (Z(0, "thru", "js pipe"), f(t)), t.getType = () => l.fullName, !i && (t.subscribe = (f) => (Ct(f), t.watch(I(f) ? f : (a) => f.next && f.next(a))), t[bt] = () => t), d; | ||
return t.parent = c, t.compositeName = l, t.defaultConfig = n, t.thru = (f) => (Z(0, "thru", "js pipe"), f(t)), t.getType = () => l.fullName, !i && (t.subscribe = (f) => (Ct(f), t.watch(B(f) ? f : (a) => f.next && f.next(a))), t[bt] = () => t), d; | ||
}; | ||
const Oe = (e, t, r, n) => { | ||
const Ee = (e, t, r, n) => { | ||
let i; | ||
K(r) && (i = r, r = r.fn); | ||
H(r) && (i = r, r = r.fn); | ||
let s = x({ name: `${e.shortName} → *`, derived: 1, and: i }); | ||
return ze(e, s, n, t, r), s; | ||
}, ht = (e, t, r, n, i) => { | ||
let s = le(t), o = ve({ store: s, to: "a", priority: "read" }); | ||
return Ne(e, s, n, t, r), s; | ||
}, vt = (e, t, r, n, i) => { | ||
let s = ue(t), o = pe({ store: s, to: "a", priority: "read" }); | ||
r === Q && (o.data.softRead = 1); | ||
let p = [o, N(n)]; | ||
return Y("storeOnMap", s, p, De(e) && le(e)), ze(e, t, p, r, i); | ||
let p = [o, $(n)]; | ||
return F("storeOnMap", s, p, Te(e) && ue(e)), Ne(e, t, p, r, i); | ||
}; | ||
B({ node: [Ie({ fn: ({ fn: e, value: t }) => e(t) })], meta: { op: "fx", fx: "sidechain" } }); | ||
const Kt = x(), Ut = x(), mt = x(), St = x(), gt = x(), yt = x(), qt = x(), Ft = ot({ | ||
M({ node: [Be({ fn: ({ fn: e, value: t }) => e(t) })], meta: { op: "fx", fx: "sidechain" } }); | ||
const Kt = x(), Ut = x(), ht = x(), mt = x(), St = x(), gt = x(), qt = x(), Ft = nt({ | ||
activeView: null, | ||
@@ -475,12 +473,12 @@ activePanel: null, | ||
activePanel: t | ||
})).on(St, (e, t) => ({ | ||
})).on(mt, (e, t) => ({ | ||
...e, | ||
activeModal: t | ||
})).on(gt, (e, t) => ({ | ||
})).on(St, (e, t) => ({ | ||
...e, | ||
activePopout: t | ||
})).on(yt, (e) => ({ | ||
})).on(gt, (e) => ({ | ||
...e, | ||
isRouteInit: !0 | ||
})).on(mt, (e, { view: t, panel: r }) => ({ | ||
})).on(ht, (e, { view: t, panel: r }) => ({ | ||
...e, | ||
@@ -496,10 +494,10 @@ activeView: t, | ||
} | ||
var Ye = {}, Jt = { | ||
var Fe = {}, Jt = { | ||
get exports() { | ||
return Ye; | ||
return Fe; | ||
}, | ||
set exports(e) { | ||
Ye = e; | ||
Fe = e; | ||
} | ||
}, be = {}, re = {}, Qt = { | ||
}, Oe = {}, re = {}, Qt = { | ||
get exports() { | ||
@@ -511,3 +509,3 @@ return re; | ||
} | ||
}, Le = {}; | ||
}, be = {}; | ||
/** | ||
@@ -522,7 +520,7 @@ * @license React | ||
*/ | ||
var Je; | ||
var Ye; | ||
function Xt() { | ||
if (Je) | ||
return Le; | ||
Je = 1; | ||
if (Ye) | ||
return be; | ||
Ye = 1; | ||
var e = P; | ||
@@ -557,5 +555,5 @@ function t(l, d) { | ||
var S = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : p; | ||
return Le.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : S, Le; | ||
return be.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : S, be; | ||
} | ||
var Re = {}; | ||
var Le = {}; | ||
/** | ||
@@ -570,5 +568,5 @@ * @license React | ||
*/ | ||
var Qe; | ||
var Je; | ||
function Zt() { | ||
return Qe || (Qe = 1, process.env.NODE_ENV !== "production" && function() { | ||
return Je || (Je = 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()); | ||
@@ -609,17 +607,17 @@ var e = P, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
} | ||
}), b = E[0].inst, U = E[1]; | ||
}), b = E[0].inst, K = E[1]; | ||
return g(function() { | ||
b.value = m, b.getSnapshot = h, f(b) && U({ | ||
b.value = m, b.getSnapshot = h, f(b) && K({ | ||
inst: b | ||
}); | ||
}, [w, m, h]), p(function() { | ||
f(b) && U({ | ||
f(b) && K({ | ||
inst: b | ||
}); | ||
var he = function() { | ||
f(b) && U({ | ||
var ve = function() { | ||
f(b) && K({ | ||
inst: b | ||
}); | ||
}; | ||
return w(he); | ||
return w(ve); | ||
}, [w]), c(m), m; | ||
@@ -639,5 +637,5 @@ } | ||
} | ||
var u = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !u, L = v ? a : d, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : L; | ||
Re.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
}()), Re; | ||
var u = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !u, L = v ? a : d, A = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : L; | ||
Le.useSyncExternalStore = A, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
}()), Le; | ||
} | ||
@@ -657,7 +655,7 @@ (function(e) { | ||
*/ | ||
var Xe; | ||
var Qe; | ||
function tr() { | ||
if (Xe) | ||
return be; | ||
Xe = 1; | ||
if (Qe) | ||
return Oe; | ||
Qe = 1; | ||
var e = P, t = re; | ||
@@ -668,3 +666,3 @@ function r(c, S) { | ||
var n = typeof Object.is == "function" ? Object.is : r, i = t.useSyncExternalStore, s = e.useRef, o = e.useEffect, p = e.useMemo, g = e.useDebugValue; | ||
return be.useSyncExternalStoreWithSelector = function(c, S, l, d, f) { | ||
return Oe.useSyncExternalStoreWithSelector = function(c, S, l, d, f) { | ||
var a = s(null); | ||
@@ -678,4 +676,4 @@ if (a.current === null) { | ||
function L(m) { | ||
if (!k) { | ||
if (k = !0, w = m, m = d(m), f !== void 0 && u.hasValue) { | ||
if (!A) { | ||
if (A = !0, w = m, m = d(m), f !== void 0 && u.hasValue) { | ||
var y = u.value; | ||
@@ -692,3 +690,3 @@ if (f(y, m)) | ||
} | ||
var k = !1, w, h, _ = l === void 0 ? null : l; | ||
var A = !1, w, h, _ = l === void 0 ? null : l; | ||
return [function() { | ||
@@ -704,5 +702,5 @@ return L(S()); | ||
}, [v]), g(v), v; | ||
}, be; | ||
}, Oe; | ||
} | ||
var ke = {}; | ||
var Re = {}; | ||
/** | ||
@@ -717,5 +715,5 @@ * @license React | ||
*/ | ||
var Ze; | ||
var Xe; | ||
function rr() { | ||
return Ze || (Ze = 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()); | ||
@@ -734,25 +732,25 @@ var e = P, t = re; | ||
var L = p(function() { | ||
var _ = !1, m, y, E = function(q) { | ||
var _ = !1, m, y, E = function(U) { | ||
if (!_) { | ||
_ = !0, m = q; | ||
var me = f(q); | ||
_ = !0, m = U; | ||
var he = f(U); | ||
if (a !== void 0 && v.hasValue) { | ||
var Se = v.value; | ||
if (a(Se, me)) | ||
return y = Se, Se; | ||
var me = v.value; | ||
if (a(me, he)) | ||
return y = me, me; | ||
} | ||
return y = me, me; | ||
return y = he, he; | ||
} | ||
var wt = m, ge = y; | ||
if (n(wt, q)) | ||
return ge; | ||
var ye = f(q); | ||
return a !== void 0 && a(ge, ye) ? ge : (m = q, y = ye, ye); | ||
}, b = d === void 0 ? null : d, U = function() { | ||
var _t = m, Se = y; | ||
if (n(_t, U)) | ||
return Se; | ||
var ge = f(U); | ||
return a !== void 0 && a(Se, ge) ? Se : (m = U, y = ge, ge); | ||
}, b = d === void 0 ? null : d, K = function() { | ||
return E(l()); | ||
}, he = b === null ? void 0 : function() { | ||
}, ve = b === null ? void 0 : function() { | ||
return E(b()); | ||
}; | ||
return [U, he]; | ||
}, [l, d, f, a]), k = L[0], w = L[1], h = i(S, k, w); | ||
return [K, ve]; | ||
}, [l, d, f, a]), A = L[0], w = L[1], h = i(S, A, w); | ||
return o(function() { | ||
@@ -762,4 +760,4 @@ v.hasValue = !0, v.value = h; | ||
} | ||
ke.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
}()), ke; | ||
Re.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
}()), Re; | ||
} | ||
@@ -772,12 +770,12 @@ (function(e) { | ||
if (n && i.unshift(n), r) { | ||
let s = B({ node: i }), o = e.graphite.id, p = r.additionalLinks, g = p[o] || []; | ||
let s = M({ node: i }), o = e.graphite.id, p = r.additionalLinks, g = p[o] || []; | ||
return p[o] = g, g.push(s), () => { | ||
let c = g.indexOf(s); | ||
c !== -1 && g.splice(c, 1), Ce(s); | ||
c !== -1 && g.splice(c, 1), Pe(s); | ||
}; | ||
} | ||
{ | ||
let s = B({ node: i, parent: [e], family: { owners: e } }); | ||
let s = M({ node: i, parent: [e], family: { owners: e } }); | ||
return () => { | ||
Ce(s); | ||
Pe(s); | ||
}; | ||
@@ -787,3 +785,3 @@ } | ||
function or(e, t) { | ||
At.store(e) || _t("expect useStore argument to be a store"); | ||
kt.store(e) || yt("expect useStore argument to be a store"); | ||
let r = P.useCallback((i) => nr(e, i, t), [e, t]), n = P.useCallback(() => ur(e, t), [e, t]); | ||
@@ -794,3 +792,3 @@ return sr(r, n, n); | ||
let t = P.useContext(lr); | ||
return e && !t && _t("No scope found, consider adding <Provider> to app root"), t; | ||
return e && !t && yt("No scope found, consider adding <Provider> to app root"), t; | ||
} | ||
@@ -800,3 +798,3 @@ function ar(e, t) { | ||
} | ||
let _t = (e) => { | ||
let yt = (e) => { | ||
throw Error(e); | ||
@@ -806,3 +804,3 @@ }; | ||
const { useSyncExternalStore: sr } = er, ur = (e, t) => t ? t.getState(e) : e.getState(), lr = P.createContext(null), cr = (e, t, r) => { | ||
tt(() => { | ||
et(() => { | ||
const n = (i) => { | ||
@@ -813,7 +811,7 @@ i instanceof KeyboardEvent && i.key === r ? t(i) : r || t(i); | ||
}, [e, r, t]); | ||
}, et = (e, t, r) => { | ||
tt(() => (M.addEventListener(e, t, r), () => M.removeEventListener(r)), [e, r, t]); | ||
}, Ze = (e, t, r) => { | ||
et(() => (J.addEventListener(e, t, r), () => J.removeEventListener(r)), [e, r, t]); | ||
}, gr = (e, ...t) => { | ||
et("init", (p) => { | ||
console.log("[blum]: initialized", p), o || rt(e); | ||
Ze("init", (p) => { | ||
console.log("[blum]: initialized", p), o || tt(e); | ||
}, 1); | ||
@@ -823,3 +821,3 @@ const { activeView: r, activePanel: n, activeModal: i, activePopout: s, isRouteInit: o } = fr(); | ||
o && (await (async () => { | ||
M.fireChangeStateEvent(); | ||
J.fireChangeStateEvent(); | ||
const { view: g, panel: c, modal: S, popout: l } = window.history.state ?? { | ||
@@ -841,19 +839,19 @@ view: void 0, | ||
})(), window.isBackFromBrowser = !0); | ||
}), et("changestate", (p) => { | ||
}), Ze("changestate", (p) => { | ||
if (console.log("[blum]: state changed", p), p) { | ||
const { view: g, panel: c, modal: S, popout: l } = p; | ||
g && c && mt({ view: g, panel: c }), St(S), gt(l), o || yt(); | ||
g && c && ht({ view: g, panel: c }), mt(S), St(l), o || gt(); | ||
} | ||
}, 2); | ||
}, fr = () => ar(Ft), yr = (e) => e, _r = (e, t) => (r, n) => ["view", "panel", "modal", "popout"].some((s) => r[s] === e && r[s] !== n[s]) && window.isBackFromBrowser ? (t && t(r, n), rt(r), !1) : !0; | ||
}, fr = () => ar(Ft), yr = (e) => e, _r = (e, t) => (r, n) => ["view", "panel", "modal", "popout"].some((s) => r[s] === e && r[s] !== n[s]) && window.isBackFromBrowser ? (t && t(r, n), tt(r), !1) : !0; | ||
export { | ||
St as _setActiveModal, | ||
mt as _setActiveModal, | ||
Ut as _setActivePanel, | ||
gt as _setActivePopout, | ||
St as _setActivePopout, | ||
Kt as _setActiveView, | ||
pr as back, | ||
M as blumRouter, | ||
J as blumRouter, | ||
_r as createDisableBackBrowserRouteMiddleware, | ||
yr as createRouteMiddleware, | ||
rt as historyPush, | ||
tt as historyPush, | ||
mr as setActiveModal, | ||
@@ -860,0 +858,0 @@ hr as setActivePanel, |
{ | ||
"name": "@blumjs/router", | ||
"version": "6.3.0", | ||
"version": "6.3.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
60935
1027