@milkdown/ctx
Advanced tools
Comparing version 6.5.0 to 6.5.2
@@ -1,125 +0,151 @@ | ||
var T = (e, i, r) => { | ||
if (!i.has(e)) | ||
throw TypeError("Cannot " + r); | ||
var P = Object.defineProperty; | ||
var k = (e, t, i) => t in e ? P(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i; | ||
var r = (e, t, i) => (k(e, typeof t != "symbol" ? t + "" : t, i), i), E = (e, t, i) => { | ||
if (!t.has(e)) | ||
throw TypeError("Cannot " + i); | ||
}; | ||
var n = (e, i, r) => (T(e, i, "read from private field"), r ? r.call(e) : i.get(e)), h = (e, i, r) => { | ||
if (i.has(e)) | ||
var n = (e, t, i) => (E(e, t, "read from private field"), i ? i.call(e) : t.get(e)), u = (e, t, i) => { | ||
if (t.has(e)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
i instanceof WeakSet ? i.add(e) : i.set(e, r); | ||
}, a = (e, i, r, t) => (T(e, i, "write to private field"), t ? t.call(e, r) : i.set(e, r), r); | ||
import { contextNotFound as N, ctxCallOutOfScope as P, timerNotFound as k } from "@milkdown/exception"; | ||
const j = () => { | ||
t instanceof WeakSet ? t.add(e) : t.set(e, i); | ||
}, h = (e, t, i, s) => (E(e, t, "write to private field"), s ? s.call(e, i) : t.set(e, i), i); | ||
import { contextNotFound as M, ctxCallOutOfScope as b, timerNotFound as x } from "@milkdown/exception"; | ||
const F = () => { | ||
const e = /* @__PURE__ */ new Map(); | ||
return { sliceMap: e, getSlice: (t) => { | ||
const s = typeof t == "string" ? [...e.values()].find((o) => o.name === t) : e.get(t.id); | ||
if (!s) { | ||
const o = typeof t == "string" ? t : t.sliceName; | ||
throw N(o); | ||
return { sliceMap: e, getSlice: (s) => { | ||
const o = typeof s == "string" ? [...e.values()].find((c) => c.name === s) : e.get(s.id); | ||
if (!o) { | ||
const c = typeof s == "string" ? s : s.sliceName; | ||
throw M(c); | ||
} | ||
return s; | ||
}, removeSlice: (t) => { | ||
const s = typeof t == "string" ? [...e.values()].find((o) => o.name === t) : e.get(t.id); | ||
!s || e.delete(s.id); | ||
return o; | ||
}, removeSlice: (s) => { | ||
const o = typeof s == "string" ? [...e.values()].find((c) => c.name === s) : e.get(s.id); | ||
!o || e.delete(o.id); | ||
} }; | ||
}, M = (e) => Array.isArray(e) ? [...e] : typeof e == "object" ? { ...e } : e, L = (e, i) => { | ||
const r = Symbol(`Context-${i}`), t = (s, o = M(e)) => { | ||
let c = o; | ||
const d = { | ||
name: i, | ||
id: r, | ||
set: (u) => { | ||
c = u; | ||
}, j = (e) => Array.isArray(e) ? [...e] : typeof e == "object" ? { ...e } : e, I = (e, t) => { | ||
const i = Symbol(`Context-${t}`), s = (o, c = j(e)) => { | ||
let a = c; | ||
const g = { | ||
name: t, | ||
id: i, | ||
set: (m) => { | ||
a = m; | ||
}, | ||
get: () => c, | ||
update: (u) => { | ||
c = u(c); | ||
get: () => a, | ||
update: (m) => { | ||
a = m(a); | ||
} | ||
}; | ||
return s.set(r, d), d; | ||
return o.set(i, g), g; | ||
}; | ||
return t.sliceName = i, t.id = r, t._typeInfo = () => { | ||
throw P(); | ||
}, t; | ||
return s.sliceName = t, s.id = i, s._typeInfo = () => { | ||
throw b(); | ||
}, s; | ||
}; | ||
var g, p; | ||
class A { | ||
constructor(i, r) { | ||
h(this, g, void 0); | ||
h(this, p, void 0); | ||
this.use = (t) => n(this, g).getSlice(t), this.get = (t) => this.use(t).get(), this.set = (t, s) => this.use(t).set(s), this.update = (t, s) => this.use(t).update(s), this.timing = (t) => n(this, p).get(t), this.done = (t) => this.timing(t).done(), this.wait = (t) => this.timing(t)(), this.waitTimers = async (t) => { | ||
await Promise.all(this.get(t).map((s) => this.wait(s))); | ||
}, a(this, g, i), a(this, p, r); | ||
var p, v; | ||
class O { | ||
constructor(t, i) { | ||
u(this, p, void 0); | ||
u(this, v, void 0); | ||
r(this, "use", (t) => n(this, p).getSlice(t)); | ||
r(this, "get", (t) => this.use(t).get()); | ||
r(this, "set", (t, i) => this.use(t).set(i)); | ||
r(this, "update", (t, i) => this.use(t).update(i)); | ||
r(this, "timing", (t) => n(this, v).get(t)); | ||
r(this, "done", (t) => this.timing(t).done()); | ||
r(this, "wait", (t) => this.timing(t)()); | ||
r(this, "waitTimers", async (t) => { | ||
await Promise.all(this.get(t).map((i) => this.wait(i))); | ||
}); | ||
h(this, p, t), h(this, v, i); | ||
} | ||
} | ||
g = new WeakMap(), p = new WeakMap(); | ||
var m, l; | ||
class F { | ||
constructor(i, r) { | ||
h(this, m, void 0); | ||
h(this, l, void 0); | ||
this.inject = (t, s) => (t(n(this, m).sliceMap, s), this), this.remove = (t) => (n(this, m).removeSlice(t), this), this.record = (t) => (t(n(this, l).store), this), this.clearTimer = (t) => (n(this, l).remove(t), this), this.use = (t) => n(this, m).getSlice(t), this.get = (t) => this.use(t).get(), this.set = (t, s) => this.use(t).set(s), this.update = (t, s) => this.use(t).update(s), this.timing = (t) => n(this, l).get(t), this.wait = (t) => this.timing(t)(), this.done = (t) => this.timing(t).done(), this.waitTimers = async (t) => { | ||
await Promise.all(this.get(t).map((s) => this.wait(s))); | ||
}, a(this, m, i), a(this, l, r); | ||
p = new WeakMap(), v = new WeakMap(); | ||
var l, d; | ||
class $ { | ||
constructor(t, i) { | ||
u(this, l, void 0); | ||
u(this, d, void 0); | ||
r(this, "inject", (t, i) => (t(n(this, l).sliceMap, i), this)); | ||
r(this, "remove", (t) => (n(this, l).removeSlice(t), this)); | ||
r(this, "record", (t) => (t(n(this, d).store), this)); | ||
r(this, "clearTimer", (t) => (n(this, d).remove(t), this)); | ||
r(this, "use", (t) => n(this, l).getSlice(t)); | ||
r(this, "get", (t) => this.use(t).get()); | ||
r(this, "set", (t, i) => this.use(t).set(i)); | ||
r(this, "update", (t, i) => this.use(t).update(i)); | ||
r(this, "timing", (t) => n(this, d).get(t)); | ||
r(this, "wait", (t) => this.timing(t)()); | ||
r(this, "done", (t) => this.timing(t).done()); | ||
r(this, "waitTimers", async (t) => { | ||
await Promise.all(this.get(t).map((i) => this.wait(i))); | ||
}); | ||
h(this, l, t), h(this, d, i); | ||
} | ||
} | ||
m = new WeakMap(), l = new WeakMap(); | ||
var v, f; | ||
class I { | ||
constructor(i, r) { | ||
h(this, v, void 0); | ||
h(this, f, void 0); | ||
this.clearTimer = (t) => (n(this, f).remove(t), this), this.remove = (t) => (n(this, v).removeSlice(t), this), a(this, v, i), a(this, f, r); | ||
l = new WeakMap(), d = new WeakMap(); | ||
var f, w; | ||
class _ { | ||
constructor(t, i) { | ||
u(this, f, void 0); | ||
u(this, w, void 0); | ||
r(this, "clearTimer", (t) => (n(this, w).remove(t), this)); | ||
r(this, "remove", (t) => (n(this, f).removeSlice(t), this)); | ||
h(this, f, t), h(this, w, i); | ||
} | ||
} | ||
v = new WeakMap(), f = new WeakMap(); | ||
var w, y; | ||
class O { | ||
constructor(i, r) { | ||
h(this, w, void 0); | ||
h(this, y, void 0); | ||
this.inject = (t, s) => (t(n(this, w).sliceMap, s), this), this.record = (t) => (t(n(this, y).store), this), a(this, w, i), a(this, y, r); | ||
f = new WeakMap(), w = new WeakMap(); | ||
var y, S; | ||
class q { | ||
constructor(t, i) { | ||
u(this, y, void 0); | ||
u(this, S, void 0); | ||
r(this, "inject", (t, i) => (t(n(this, y).sliceMap, i), this)); | ||
r(this, "record", (t) => (t(n(this, S).store), this)); | ||
h(this, y, t), h(this, S, i); | ||
} | ||
} | ||
w = new WeakMap(), y = new WeakMap(); | ||
const $ = () => { | ||
y = new WeakMap(), S = new WeakMap(); | ||
const z = () => { | ||
const e = /* @__PURE__ */ new Map(); | ||
return { | ||
store: e, | ||
get: (t) => { | ||
const s = e.get(t.id); | ||
if (!s) | ||
throw k(t.timerName); | ||
return s; | ||
get: (s) => { | ||
const o = e.get(s.id); | ||
if (!o) | ||
throw x(s.timerName); | ||
return o; | ||
}, | ||
remove: (t) => { | ||
e.delete(t.id); | ||
remove: (s) => { | ||
e.delete(s.id); | ||
} | ||
}; | ||
}, _ = (e, i = 3e3) => { | ||
const r = Symbol("Timer"), t = (s) => { | ||
let o = null, c; | ||
const d = Symbol(e), u = () => o != null ? o : o = new Promise((S, E) => { | ||
c = (C) => { | ||
C instanceof CustomEvent && C.detail.id === d && (removeEventListener(e, c), C.stopImmediatePropagation(), S()); | ||
}, B = (e, t = 3e3) => { | ||
const i = Symbol("Timer"), s = (o) => { | ||
let c = null, a; | ||
const g = Symbol(e), m = () => c != null ? c : c = new Promise((C, N) => { | ||
a = (T) => { | ||
T instanceof CustomEvent && T.detail.id === g && (removeEventListener(e, a), T.stopImmediatePropagation(), C()); | ||
}, setTimeout(() => { | ||
E(`Timing ${e} timeout.`), removeEventListener(e, c); | ||
}, i), addEventListener(e, c); | ||
N(`Timing ${e} timeout.`), removeEventListener(e, a); | ||
}, t), addEventListener(e, a); | ||
}); | ||
return u.done = () => { | ||
const S = new CustomEvent(e, { detail: { id: d } }); | ||
dispatchEvent(S); | ||
}, s.set(r, u), u; | ||
return m.done = () => { | ||
const C = new CustomEvent(e, { detail: { id: g } }); | ||
dispatchEvent(C); | ||
}, o.set(i, m), m; | ||
}; | ||
return t.id = r, t.timerName = e, t; | ||
return s.id = i, s.timerName = e, s; | ||
}; | ||
export { | ||
A as Ctx, | ||
F as Env, | ||
I as Post, | ||
O as Pre, | ||
$ as createClock, | ||
j as createContainer, | ||
L as createSlice, | ||
_ as createTimer | ||
O as Ctx, | ||
$ as Env, | ||
_ as Post, | ||
q as Pre, | ||
z as createClock, | ||
F as createContainer, | ||
I as createSlice, | ||
B as createTimer | ||
}; | ||
//# sourceMappingURL=index.es.js.map |
{ | ||
"name": "@milkdown/ctx", | ||
"version": "6.5.0", | ||
"version": "6.5.2", | ||
"type": "module", | ||
@@ -23,3 +23,3 @@ "main": "./lib/index.es.js", | ||
"dependencies": { | ||
"@milkdown/exception": "6.5.0", | ||
"@milkdown/exception": "6.5.2", | ||
"tslib": "^2.4.0" | ||
@@ -26,0 +26,0 @@ }, |
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
61314
1011
+ Added@milkdown/exception@6.5.2(transitive)
- Removed@milkdown/exception@6.5.0(transitive)
Updated@milkdown/exception@6.5.2