@milkdown/utils
Advanced tools
Comparing version 6.5.0 to 6.5.2
@@ -54,7 +54,11 @@ import { createTimer as jt, SchemaReady as g, commandsCtx as S, commandsTimerCtx as St, inputRulesCtx as K, editorStateTimerCtx as X, ThemeReady as M, marksCtx as $, schemaCtx as R, schemaTimerCtx as Y, nodesCtx as b, prosePluginsCtx as j, InitReady as Z, remarkPluginsCtx as q, nodeViewCtx as B, markViewCtx as G, editorViewTimerCtx as Tt, themeManagerCtx as _, emotionCtx as Rt, createSlice as k, createContainer as Et, createClock as Ot, Env as At, editorCtx as $t, editorViewCtx as E, serializerCtx as bt, parserCtx as yt, editorStateOptionsCtx as Mt } from "@milkdown/core"; | ||
return n; | ||
}, Xt = (s, n) => T(async (t, e) => { | ||
await t.wait(g); | ||
const [a, c] = await s(t); | ||
t.get(S).create(a, c), e.run = (r) => t.get(S).call(a, r), e.key = a; | ||
}, St, n), Yt = (s) => { | ||
}, Xt = (s, n) => T( | ||
async (t, e) => { | ||
await t.wait(g); | ||
const [a, c] = await s(t); | ||
t.get(S).create(a, c), e.run = (r) => t.get(S).call(a, r), e.key = a; | ||
}, | ||
St, | ||
n | ||
), Yt = (s) => { | ||
const n = () => async (t) => { | ||
@@ -66,7 +70,11 @@ await t.wait(g); | ||
return n; | ||
}, Zt = (s, n) => T(async (t, e) => { | ||
await t.wait(g); | ||
const a = await s(t); | ||
t.update(K, (c) => [...c, a]), e.inputRule = a; | ||
}, X, n), _t = (s, n) => { | ||
}, Zt = (s, n) => T( | ||
async (t, e) => { | ||
await t.wait(g); | ||
const a = await s(t); | ||
t.update(K, (c) => [...c, a]), e.inputRule = a; | ||
}, | ||
X, | ||
n | ||
), _t = (s, n) => { | ||
const t = () => async (e) => { | ||
@@ -82,11 +90,15 @@ await e.wait(M); | ||
return t; | ||
}, xt = (s, n, t) => T(async (e, a, c) => { | ||
await e.wait(M); | ||
const r = await n(e); | ||
e.update($, (u) => [...u, [s, r]]), a.id = s, a.schema = r, c(), await e.wait(g); | ||
const o = e.get(R).marks[s]; | ||
if (!o) | ||
throw ft(s); | ||
a.type = o; | ||
}, Y, t), te = (s, n) => { | ||
}, xt = (s, n, t) => T( | ||
async (e, a, c) => { | ||
await e.wait(M); | ||
const r = await n(e); | ||
e.update($, (u) => [...u, [s, r]]), a.id = s, a.schema = r, c(), await e.wait(g); | ||
const o = e.get(R).marks[s]; | ||
if (!o) | ||
throw ft(s); | ||
a.type = o; | ||
}, | ||
Y, | ||
t | ||
), te = (s, n) => { | ||
const t = () => async (e) => { | ||
@@ -102,11 +114,15 @@ await e.wait(M); | ||
return t; | ||
}, ee = (s, n, t) => T(async (e, a, c) => { | ||
await e.wait(M); | ||
const r = await n(e); | ||
e.update(b, (u) => [...u, [s, r]]), a.id = s, a.schema = r, c(), await e.wait(g); | ||
const o = e.get(R).nodes[s]; | ||
if (!o) | ||
throw Pt(s); | ||
a.type = o; | ||
}, Y, t), ne = (s) => { | ||
}, ee = (s, n, t) => T( | ||
async (e, a, c) => { | ||
await e.wait(M); | ||
const r = await n(e); | ||
e.update(b, (u) => [...u, [s, r]]), a.id = s, a.schema = r, c(), await e.wait(g); | ||
const o = e.get(R).nodes[s]; | ||
if (!o) | ||
throw Pt(s); | ||
a.type = o; | ||
}, | ||
Y, | ||
t | ||
), ne = (s) => { | ||
const n = () => async (t) => { | ||
@@ -118,7 +134,11 @@ await t.wait(g); | ||
return n; | ||
}, se = (s, n) => T(async (t, e) => { | ||
await t.wait(g); | ||
const a = await s(t); | ||
t.update(j, (c) => [...c, a]), e.plugin = a; | ||
}, X, n), ae = (s) => { | ||
}, se = (s, n) => T( | ||
async (t, e) => { | ||
await t.wait(g); | ||
const a = await s(t); | ||
t.update(j, (c) => [...c, a]), e.plugin = a; | ||
}, | ||
X, | ||
n | ||
), ae = (s) => { | ||
const n = () => async (t) => { | ||
@@ -130,7 +150,11 @@ await t.wait(Z); | ||
return n; | ||
}, ce = (s, n) => T(async (t, e) => { | ||
await t.wait(Z); | ||
const a = await s(t); | ||
t.update(q, (c) => [...c, a]), e.plugin = a; | ||
}, Y, n), re = (s) => { | ||
}, ce = (s, n) => T( | ||
async (t, e) => { | ||
await t.wait(Z); | ||
const a = await s(t); | ||
t.update(q, (c) => [...c, a]), e.plugin = a; | ||
}, | ||
Y, | ||
n | ||
), re = (s) => { | ||
const n = () => async (t) => { | ||
@@ -142,7 +166,11 @@ await t.wait(g); | ||
return n; | ||
}, ie = (s, n) => T(async (t, e) => { | ||
await t.wait(g); | ||
const a = await s(t); | ||
t.update(j, (c) => [...c, x(a)]), e.keymap = a; | ||
}, X, n), oe = (s, n) => { | ||
}, ie = (s, n) => T( | ||
async (t, e) => { | ||
await t.wait(g); | ||
const a = await s(t); | ||
t.update(j, (c) => [...c, x(a)]), e.keymap = a; | ||
}, | ||
X, | ||
n | ||
), oe = (s, n) => { | ||
const t = () => async (e) => { | ||
@@ -154,7 +182,11 @@ await e.wait(g); | ||
return t; | ||
}, ue = (s, n, t) => T(async (e, a) => { | ||
await e.wait(g); | ||
const c = await n(e); | ||
s.type instanceof kt ? e.update(B, (r) => [...r, [s.id, c]]) : e.update(G, (r) => [...r, [s.id, c]]), a.view = c, a.type = s; | ||
}, Tt, t), Nt = (s) => (n, ...t) => { | ||
}, ue = (s, n, t) => T( | ||
async (e, a) => { | ||
await e.wait(g); | ||
const c = await n(e); | ||
s.type instanceof kt ? e.update(B, (r) => [...r, [s.id, c]]) : e.update(G, (r) => [...r, [s.id, c]]), a.view = c, a.type = s; | ||
}, | ||
Tt, | ||
t | ||
), Nt = (s) => (n, ...t) => { | ||
var a; | ||
@@ -205,3 +237,6 @@ const e = (a = s == null ? void 0 : s(n, ...t)) != null ? a : t; | ||
await t.wait(M), await n(); | ||
}, V = k(void 0, "getRemarkPluginsPipeCtx"), ct = async (s, n) => { | ||
}, V = k( | ||
void 0, | ||
"getRemarkPluginsPipeCtx" | ||
), ct = async (s, n) => { | ||
const { ctx: t, pipelineCtx: e, onCleanup: a } = s; | ||
@@ -238,3 +273,6 @@ await t.wait(Z); | ||
e.set(L, f), await n(); | ||
}, N = k(void 0, "getCommandsPipeCtx"), it = async (s, n) => { | ||
}, N = k( | ||
void 0, | ||
"getCommandsPipeCtx" | ||
), it = async (s, n) => { | ||
const { ctx: t, pipelineCtx: e, onCleanup: a } = s, c = e.get(N); | ||
@@ -252,3 +290,6 @@ if (c) { | ||
await n(); | ||
}, U = k(void 0, "getInputRulesPipeCtx"), ot = async (s, n) => { | ||
}, U = k( | ||
void 0, | ||
"getInputRulesPipeCtx" | ||
), ot = async (s, n) => { | ||
const { ctx: t, pipelineCtx: e, onCleanup: a } = s, c = e.get(U); | ||
@@ -273,3 +314,6 @@ if (c) { | ||
}), await n(); | ||
}, H = k(void 0, "getProsePluginsPipeCtx"), lt = async (s, n) => { | ||
}, H = k( | ||
void 0, | ||
"getProsePluginsPipeCtx" | ||
), lt = async (s, n) => { | ||
const { pipelineCtx: t, ctx: e, onCleanup: a } = s, c = t.get(H); | ||
@@ -286,3 +330,7 @@ if (c) { | ||
if (o) { | ||
const u = Object.entries(o).filter(([i]) => e.get(b).findIndex((d) => d[0] === i) !== -1), l = Object.entries(o).filter(([i]) => e.get($).findIndex((d) => d[0] === i) !== -1); | ||
const u = Object.entries(o).filter( | ||
([i]) => e.get(b).findIndex((d) => d[0] === i) !== -1 | ||
), l = Object.entries(o).filter( | ||
([i]) => e.get($).findIndex((d) => d[0] === i) !== -1 | ||
); | ||
e.update(B, (i) => [...i, ...u]), e.update(G, (i) => [...i, ...l]), a(() => { | ||
@@ -316,3 +364,5 @@ e.update(B, (i) => i.filter((d) => !u.includes(d))), e.update(G, (i) => i.filter((d) => !l.includes(d))); | ||
}, o = async (l) => { | ||
await Promise.all([...a].map((i) => i(l))); | ||
await Promise.all( | ||
[...a].map((i) => i(l)) | ||
); | ||
}, u = (l, i) => n({ | ||
@@ -325,83 +375,98 @@ pre: l, | ||
return u.runCleanup = o, u; | ||
}, Dt = (s) => nt(tt, et(s, Dt))((n) => (t) => async (e) => { | ||
const c = wt([ | ||
mt, | ||
at, | ||
async ({ pipelineCtx: r }, o) => { | ||
const u = J(e, n), l = s(u, n), { | ||
id: i, | ||
commands: d, | ||
remarkPlugins: f, | ||
schema: h, | ||
inputRules: p, | ||
shortcuts: w, | ||
prosePlugins: y, | ||
view: v, | ||
injectSlices: C | ||
} = l, A = n == null ? void 0 : n.view, Q = C != null ? C : [], W = { | ||
...n || {}, | ||
view: A ? (m) => ({ [i]: A(m) }) : void 0 | ||
}; | ||
r.set(I, Q), r.set(pt, i), r.set(O, W), r.set(V, f), r.set(z, (m) => ({ mark: { [i]: h(m) } })), d && r.set(N, (m, P) => d(m[i], P)), p && r.set(U, (m, P) => p(m[i], P)), w && r.set(D, w), y && r.set(H, (m, P) => y(m[i], P)), v && r.set(F, (m) => ({ [i]: v(m) })), await o(); | ||
}, | ||
st, | ||
ct, | ||
rt, | ||
it, | ||
ot, | ||
ut, | ||
lt, | ||
dt | ||
]); | ||
return await c(t, e), c.runCleanup; | ||
}), Ht = (s) => nt(tt, et(s, Ht))((n) => (t) => async (e) => { | ||
const c = wt([ | ||
mt, | ||
at, | ||
async ({ pipelineCtx: r }, o) => { | ||
const u = J(e, n), l = s(u, n), { | ||
id: i, | ||
commands: d, | ||
remarkPlugins: f, | ||
schema: h, | ||
inputRules: p, | ||
shortcuts: w, | ||
prosePlugins: y, | ||
view: v, | ||
injectSlices: C | ||
} = l, A = n == null ? void 0 : n.view, Q = C != null ? C : [], W = { | ||
...n || {}, | ||
view: A ? (m) => ({ [i]: A(m) }) : void 0 | ||
}; | ||
r.set(I, Q), r.set(pt, i), r.set(O, W), r.set(V, f), r.set(z, (m) => ({ node: { [i]: h(m) } })), d && r.set(N, (m, P) => d(m[i], P)), p && r.set(U, (m, P) => p(m[i], P)), w && r.set(D, w), y && r.set(H, (m, P) => y(m[i], P)), v && r.set(F, (m) => ({ [i]: v(m) })), await o(); | ||
}, | ||
st, | ||
ct, | ||
rt, | ||
it, | ||
ot, | ||
ut, | ||
lt, | ||
dt | ||
]); | ||
return await c(t, e), c.runCleanup; | ||
}), Ft = (s) => nt(tt, et(s, Ft))((n) => (t) => async (e) => { | ||
const c = wt([ | ||
mt, | ||
at, | ||
async ({ pipelineCtx: r }, o) => { | ||
const u = J(e, n), l = s(u, n), { commands: i, remarkPlugins: d, schema: f, inputRules: h, shortcuts: p, prosePlugins: w, view: y, injectSlices: v } = l, C = v != null ? v : []; | ||
r.set(I, C), r.set(O, n || {}), r.set(V, d), f && r.set(z, f), i && r.set(N, i), h && r.set(U, h), p && r.set(D, p), w && r.set(H, w), y && r.set(F, y), await o(); | ||
}, | ||
st, | ||
ct, | ||
rt, | ||
it, | ||
ot, | ||
ut, | ||
lt, | ||
dt | ||
]); | ||
return await c(t, e), c.runCleanup; | ||
}); | ||
}, Dt = (s) => nt( | ||
tt, | ||
et(s, Dt) | ||
)( | ||
(n) => (t) => async (e) => { | ||
const c = wt([ | ||
mt, | ||
at, | ||
async ({ pipelineCtx: r }, o) => { | ||
const u = J(e, n), l = s(u, n), { | ||
id: i, | ||
commands: d, | ||
remarkPlugins: f, | ||
schema: h, | ||
inputRules: p, | ||
shortcuts: w, | ||
prosePlugins: y, | ||
view: v, | ||
injectSlices: C | ||
} = l, A = n == null ? void 0 : n.view, Q = C != null ? C : [], W = { | ||
...n || {}, | ||
view: A ? (m) => ({ [i]: A(m) }) : void 0 | ||
}; | ||
r.set(I, Q), r.set(pt, i), r.set(O, W), r.set(V, f), r.set(z, (m) => ({ mark: { [i]: h(m) } })), d && r.set(N, (m, P) => d(m[i], P)), p && r.set(U, (m, P) => p(m[i], P)), w && r.set(D, w), y && r.set(H, (m, P) => y(m[i], P)), v && r.set(F, (m) => ({ [i]: v(m) })), await o(); | ||
}, | ||
st, | ||
ct, | ||
rt, | ||
it, | ||
ot, | ||
ut, | ||
lt, | ||
dt | ||
]); | ||
return await c(t, e), c.runCleanup; | ||
} | ||
), Ht = (s) => nt( | ||
tt, | ||
et(s, Ht) | ||
)( | ||
(n) => (t) => async (e) => { | ||
const c = wt([ | ||
mt, | ||
at, | ||
async ({ pipelineCtx: r }, o) => { | ||
const u = J(e, n), l = s(u, n), { | ||
id: i, | ||
commands: d, | ||
remarkPlugins: f, | ||
schema: h, | ||
inputRules: p, | ||
shortcuts: w, | ||
prosePlugins: y, | ||
view: v, | ||
injectSlices: C | ||
} = l, A = n == null ? void 0 : n.view, Q = C != null ? C : [], W = { | ||
...n || {}, | ||
view: A ? (m) => ({ [i]: A(m) }) : void 0 | ||
}; | ||
r.set(I, Q), r.set(pt, i), r.set(O, W), r.set(V, f), r.set(z, (m) => ({ node: { [i]: h(m) } })), d && r.set(N, (m, P) => d(m[i], P)), p && r.set(U, (m, P) => p(m[i], P)), w && r.set(D, w), y && r.set(H, (m, P) => y(m[i], P)), v && r.set(F, (m) => ({ [i]: v(m) })), await o(); | ||
}, | ||
st, | ||
ct, | ||
rt, | ||
it, | ||
ot, | ||
ut, | ||
lt, | ||
dt | ||
]); | ||
return await c(t, e), c.runCleanup; | ||
} | ||
), Ft = (s) => nt( | ||
tt, | ||
et(s, Ft) | ||
)( | ||
(n) => (t) => async (e) => { | ||
const c = wt([ | ||
mt, | ||
at, | ||
async ({ pipelineCtx: r }, o) => { | ||
const u = J(e, n), l = s(u, n), { commands: i, remarkPlugins: d, schema: f, inputRules: h, shortcuts: p, prosePlugins: w, view: y, injectSlices: v } = l, C = v != null ? v : []; | ||
r.set(I, C), r.set(O, n || {}), r.set(V, d), f && r.set(z, f), i && r.set(N, i), h && r.set(U, h), p && r.set(D, p), w && r.set(H, w), y && r.set(F, y), await o(); | ||
}, | ||
st, | ||
ct, | ||
rt, | ||
it, | ||
ot, | ||
ut, | ||
lt, | ||
dt | ||
]); | ||
return await c(t, e), c.runCleanup; | ||
} | ||
); | ||
function pe(s, n) { | ||
@@ -424,3 +489,5 @@ return (t) => t.get(S).call(s, n); | ||
const c = t.state.selection.content(); | ||
return t.dispatch(t.state.tr.replaceSelection(new vt(a.content, c.openStart, c.openEnd)).scrollIntoView()); | ||
return t.dispatch( | ||
t.state.tr.replaceSelection(new vt(a.content, c.openStart, c.openEnd)).scrollIntoView() | ||
); | ||
}, fe = () => (s) => { | ||
@@ -427,0 +494,0 @@ const n = s.get(E), t = []; |
{ | ||
"name": "@milkdown/utils", | ||
"version": "6.5.0", | ||
"version": "6.5.2", | ||
"type": "module", | ||
@@ -14,4 +14,4 @@ "main": "./lib/index.es.js", | ||
"devDependencies": { | ||
"@milkdown/core": "6.5.0", | ||
"@milkdown/prose": "6.5.0" | ||
"@milkdown/core": "6.5.2", | ||
"@milkdown/prose": "6.5.2" | ||
}, | ||
@@ -23,3 +23,3 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@milkdown/exception": "6.5.0", | ||
"@milkdown/exception": "6.5.2", | ||
"nanoid": "^4.0.0", | ||
@@ -26,0 +26,0 @@ "tslib": "^2.4.0" |
Sorry, the diff of this file is not supported yet
188322
2261
+ Added@milkdown/exception@6.5.2(transitive)
- Removed@milkdown/exception@6.5.0(transitive)
Updated@milkdown/exception@6.5.2