@milkdown/core
Advanced tools
Comparing version 7.3.6 to 7.4.0
@@ -10,3 +10,3 @@ var ve = (e, t, r) => { | ||
}, c = (e, t, r, i) => (ve(e, t, "write to private field"), i ? i.call(e, r) : t.set(e, r), r); | ||
import { createTimer as v, createSlice as o, Container as Se, Clock as We, Ctx as Ye } from "@milkdown/ctx"; | ||
import { createSlice as o, createTimer as v, Container as Se, Clock as We, Ctx as Ye } from "@milkdown/ctx"; | ||
import { Schema as $e, DOMParser as qe, Node as He } from "@milkdown/prose/model"; | ||
@@ -16,10 +16,10 @@ import de from "remark-parse"; | ||
import { unified as le } from "unified"; | ||
import { ctxCallOutOfScope as Pe, docTypeError as Je, callCommandBeforeEditorView as Fe } from "@milkdown/exception"; | ||
import { callCommandBeforeEditorView as Je, ctxCallOutOfScope as Pe, docTypeError as Fe } from "@milkdown/exception"; | ||
import { ParserState as Ge, SerializerState as Qe } from "@milkdown/transformer"; | ||
import { PluginKey as Re, Plugin as be, EditorState as Ue } from "@milkdown/prose/state"; | ||
import { EditorView as Xe } from "@milkdown/prose/view"; | ||
import { customInputRules as Ze } from "@milkdown/prose"; | ||
import { chainCommands as xe, deleteSelection as et, joinBackward as tt, selectNodeBackward as rt, baseKeymap as st } from "@milkdown/prose/commands"; | ||
import { undoInputRule as it } from "@milkdown/prose/inputrules"; | ||
import { keymap as nt } from "@milkdown/prose/keymap"; | ||
import { customInputRules as Ue } from "@milkdown/prose"; | ||
import { chainCommands as Xe, deleteSelection as Ze, joinBackward as xe, selectNodeBackward as et, baseKeymap as tt } from "@milkdown/prose/commands"; | ||
import { undoInputRule as rt } from "@milkdown/prose/inputrules"; | ||
import { keymap as st } from "@milkdown/prose/keymap"; | ||
import { PluginKey as Re, Plugin as be, EditorState as it } from "@milkdown/prose/state"; | ||
import { EditorView as nt } from "@milkdown/prose/view"; | ||
function k(e, t) { | ||
@@ -55,6 +55,8 @@ return e.meta = { | ||
} | ||
}, L = v("ConfigReady"); | ||
}, L = o({}, "editorView"), V = o({}, "editorState"), G = o([], "initTimer"), ke = o({}, "editor"), ue = o([], "inputRules"), N = o([], "prosePlugins"), pe = o([], "remarkPlugins"), fe = o([], "nodeView"), ye = o([], "markView"), P = o(le().use(de).use(he), "remark"), Q = o({ | ||
handlers: De | ||
}, "remarkStringifyOptions"), W = v("ConfigReady"); | ||
function ot(e) { | ||
const t = (r) => (r.record(L), async () => (await e(r), r.done(L), () => { | ||
r.clearTimer(L); | ||
const t = (r) => (r.record(W), async () => (await e(r), r.done(W), () => { | ||
r.clearTimer(W); | ||
})); | ||
@@ -65,9 +67,7 @@ return k(t, { | ||
} | ||
const M = v("InitReady"), G = o([], "initTimer"), ke = o({}, "editor"), ue = o([], "inputRules"), N = o([], "prosePlugins"), pe = o([], "remarkPlugins"), fe = o([], "nodeView"), ye = o([], "markView"), P = o(le().use(de).use(he), "remark"), Q = o({ | ||
handlers: De | ||
}, "remarkStringifyOptions"); | ||
const M = v("InitReady"); | ||
function at(e) { | ||
const t = (r) => (r.inject(ke, e).inject(N, []).inject(pe, []).inject(ue, []).inject(fe, []).inject(ye, []).inject(Q, { | ||
handlers: De | ||
}).inject(P, le().use(de).use(he)).inject(G, [L]).record(M), async () => { | ||
}).inject(P, le().use(de).use(he)).inject(G, [W]).record(M), async () => { | ||
await r.waitTimers(G); | ||
@@ -103,27 +103,70 @@ const i = r.get(Q); | ||
}); | ||
const W = v("ParserReady"), Ie = () => { | ||
var T, g; | ||
class Ie { | ||
constructor() { | ||
d(this, T, void 0); | ||
d(this, g, void 0); | ||
c(this, T, new Se()), c(this, g, null), this.setCtx = (t) => { | ||
c(this, g, t); | ||
}; | ||
} | ||
get ctx() { | ||
return s(this, g); | ||
} | ||
/// Register a command into the manager. | ||
create(t, r) { | ||
const i = t.create(s(this, T).sliceMap); | ||
return i.set(r), i; | ||
} | ||
get(t) { | ||
return s(this, T).get(t).get(); | ||
} | ||
remove(t) { | ||
return s(this, T).remove(t); | ||
} | ||
call(t, r) { | ||
if (s(this, g) == null) | ||
throw Je(); | ||
const n = this.get(t)(r), a = s(this, g).get(L); | ||
return n(a.state, a.dispatch, a); | ||
} | ||
} | ||
T = new WeakMap(), g = new WeakMap(); | ||
function Et(e = "cmdKey") { | ||
return o(() => () => !1, e); | ||
} | ||
const je = o(new Ie(), "commands"), x = o([R], "commandsTimer"), Y = v("CommandsReady"), Ve = (e) => { | ||
const t = new Ie(); | ||
return t.setCtx(e), e.inject(je, t).inject(x, [R]).record(Y), async () => (await e.waitTimers(x), e.done(Y), () => { | ||
e.remove(je).remove(x).clearTimer(Y); | ||
}); | ||
}; | ||
k(Ve, { | ||
displayName: "Commands" | ||
}); | ||
const $ = v("ParserReady"), Me = () => { | ||
throw Pe(); | ||
}, Y = o(Ie, "parser"), x = o([], "parserTimer"), Ve = (e) => (e.inject(Y, Ie).inject(x, [R]).record(W), async () => { | ||
await e.waitTimers(x); | ||
}, q = o(Me, "parser"), ee = o([], "parserTimer"), Ne = (e) => (e.inject(q, Me).inject(ee, [R]).record($), async () => { | ||
await e.waitTimers(ee); | ||
const t = e.get(P), r = e.get(b); | ||
return e.set(Y, Ge.create(r, t)), e.done(W), () => { | ||
e.remove(Y).remove(x).clearTimer(W); | ||
return e.set(q, Ge.create(r, t)), e.done($), () => { | ||
e.remove(q).remove(ee).clearTimer($); | ||
}; | ||
}); | ||
k(Ve, { | ||
k(Ne, { | ||
displayName: "Parser" | ||
}); | ||
const $ = v("SerializerReady"), ee = o([], "serializerTimer"), Me = () => { | ||
const H = v("SerializerReady"), te = o([], "serializerTimer"), _e = () => { | ||
throw Pe(); | ||
}, te = o(Me, "serializer"), Ne = (e) => (e.inject(te, Me).inject(ee, [R]).record($), async () => { | ||
await e.waitTimers(ee); | ||
}, re = o(_e, "serializer"), ze = (e) => (e.inject(re, _e).inject(te, [R]).record(H), async () => { | ||
await e.waitTimers(te); | ||
const t = e.get(P), r = e.get(b); | ||
return e.set(te, Qe.create(r, t)), e.done($), () => { | ||
e.remove(te).remove(ee).clearTimer($); | ||
return e.set(re, Qe.create(r, t)), e.done(H), () => { | ||
e.remove(re).remove(te).clearTimer(H); | ||
}; | ||
}); | ||
k(Ne, { | ||
k(ze, { | ||
displayName: "Serializer" | ||
}); | ||
const re = o("", "defaultValue"), V = o({}, "editorState"), se = o((e) => e, "stateOptions"), ie = o([], "editorStateTimer"), q = v("EditorStateReady"); | ||
const se = o("", "defaultValue"), ie = o((e) => e, "stateOptions"), ne = o([], "editorStateTimer"), J = v("EditorStateReady"); | ||
function ct(e, t, r) { | ||
@@ -136,17 +179,17 @@ if (typeof e == "string") | ||
return He.fromJSON(r, e.value); | ||
throw Je(e); | ||
throw Fe(e); | ||
} | ||
const mt = new Re("MILKDOWN_STATE_TRACKER"); | ||
function dt(e) { | ||
const t = xe( | ||
it, | ||
et, | ||
tt, | ||
rt | ||
const t = Xe( | ||
rt, | ||
Ze, | ||
xe, | ||
et | ||
); | ||
return e.Backspace = t, e; | ||
} | ||
const _e = (e) => (e.inject(re, "").inject(V, {}).inject(se, (t) => t).inject(ie, [W, $, J]).record(q), async () => { | ||
await e.waitTimers(ie); | ||
const t = e.get(b), r = e.get(Y), i = e.get(ue), n = e.get(se), a = e.get(N), h = e.get(re), m = ct(h, r, t), f = [ | ||
const Ke = (e) => (e.inject(se, "").inject(V, {}).inject(ie, (t) => t).inject(ne, [$, H, Y]).record(J), async () => { | ||
await e.waitTimers(ne); | ||
const t = e.get(b), r = e.get(q), i = e.get(ue), n = e.get(ie), a = e.get(N), h = e.get(se), m = ct(h, r, t), f = [ | ||
...a, | ||
@@ -163,4 +206,4 @@ new be({ | ||
}), | ||
Ze({ rules: i }), | ||
nt(dt(st)) | ||
Ue({ rules: i }), | ||
st(dt(tt)) | ||
]; | ||
@@ -172,11 +215,11 @@ e.set(N, f); | ||
plugins: f | ||
}), l = Ue.create(B); | ||
return e.set(V, l), e.done(q), () => { | ||
e.remove(re).remove(V).remove(se).remove(ie).clearTimer(q); | ||
}), l = it.create(B); | ||
return e.set(V, l), e.done(J), () => { | ||
e.remove(se).remove(V).remove(ie).remove(ne).clearTimer(J); | ||
}; | ||
}); | ||
k(_e, { | ||
k(Ke, { | ||
displayName: "EditorState" | ||
}); | ||
const ne = v("EditorViewReady"), H = o({}, "editorView"), oe = o([], "editorViewTimer"), ae = o({}, "editorViewOptions"), ce = o(null, "root"), we = o(null, "rootDOM"), ge = o({}, "rootAttrs"); | ||
const oe = v("EditorViewReady"), ae = o([], "editorViewTimer"), ce = o({}, "editorViewOptions"), me = o(null, "root"), we = o(null, "rootDOM"), ge = o({}, "rootAttrs"); | ||
function ht(e, t) { | ||
@@ -191,5 +234,5 @@ const r = document.createElement("div"); | ||
} | ||
const ut = new Re("MILKDOWN_VIEW_CLEAR"), ze = (e) => (e.inject(ce, document.body).inject(H, {}).inject(ae, {}).inject(we, null).inject(ge, {}).inject(oe, [q]).record(ne), async () => { | ||
const ut = new Re("MILKDOWN_VIEW_CLEAR"), Ae = (e) => (e.inject(me, document.body).inject(L, {}).inject(ce, {}).inject(we, null).inject(ge, {}).inject(ae, [J]).record(oe), async () => { | ||
await e.wait(M); | ||
const t = e.get(ce) || document.body, r = typeof t == "string" ? document.querySelector(t) : t; | ||
const t = e.get(me) || document.body, r = typeof t == "string" ? document.querySelector(t) : t; | ||
e.update(N, (f) => [ | ||
@@ -213,4 +256,4 @@ new be({ | ||
...f | ||
]), await e.waitTimers(oe); | ||
const i = e.get(V), n = e.get(ae), a = Object.fromEntries(e.get(fe)), h = Object.fromEntries(e.get(ye)), m = new Xe(r, { | ||
]), await e.waitTimers(ae); | ||
const i = e.get(V), n = e.get(ce), a = Object.fromEntries(e.get(fe)), h = Object.fromEntries(e.get(ye)), m = new nt(r, { | ||
state: i, | ||
@@ -221,52 +264,9 @@ nodeViews: a, | ||
}); | ||
return lt(m.dom), e.set(H, m), e.done(ne), () => { | ||
m == null || m.destroy(), e.remove(ce).remove(H).remove(ae).remove(we).remove(ge).remove(oe).clearTimer(ne); | ||
return lt(m.dom), e.set(L, m), e.done(oe), () => { | ||
m == null || m.destroy(), e.remove(me).remove(L).remove(ce).remove(we).remove(ge).remove(ae).clearTimer(oe); | ||
}; | ||
}); | ||
k(ze, { | ||
k(Ae, { | ||
displayName: "EditorView" | ||
}); | ||
var T, g; | ||
class Ke { | ||
constructor() { | ||
d(this, T, void 0); | ||
d(this, g, void 0); | ||
c(this, T, new Se()), c(this, g, null), this.setCtx = (t) => { | ||
c(this, g, t); | ||
}; | ||
} | ||
get ctx() { | ||
return s(this, g); | ||
} | ||
/// Register a command into the manager. | ||
create(t, r) { | ||
const i = t.create(s(this, T).sliceMap); | ||
return i.set(r), i; | ||
} | ||
get(t) { | ||
return s(this, T).get(t).get(); | ||
} | ||
remove(t) { | ||
return s(this, T).remove(t); | ||
} | ||
call(t, r) { | ||
if (s(this, g) == null) | ||
throw Fe(); | ||
const n = this.get(t)(r), a = s(this, g).get(H); | ||
return n(a.state, a.dispatch, a); | ||
} | ||
} | ||
T = new WeakMap(), g = new WeakMap(); | ||
function Et(e = "cmdKey") { | ||
return o(() => () => !1, e); | ||
} | ||
const je = o(new Ke(), "commands"), me = o([R], "commandsTimer"), J = v("CommandsReady"), Ae = (e) => { | ||
const t = new Ke(); | ||
return t.setCtx(e), e.inject(je, t).inject(me, [R]).record(J), async () => (await e.waitTimers(me), e.done(J), () => { | ||
e.remove(je).remove(me).clearTimer(J); | ||
}); | ||
}; | ||
k(Ae, { | ||
displayName: "Commands" | ||
}); | ||
var pt = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.OnCreate = "OnCreate", e.Created = "Created", e.OnDestroy = "OnDestroy", e.Destroyed = "Destroyed", e))(pt || {}), j, p, y, D, _, z, u, w, O, K, S, E, A, C, I; | ||
@@ -296,7 +296,7 @@ const Ce = class Ce { | ||
Ee, | ||
Ne, | ||
ze, | ||
Ve, | ||
Ne, | ||
Ke, | ||
Ae, | ||
_e, | ||
ze, | ||
at(this), | ||
@@ -369,28 +369,28 @@ t | ||
export { | ||
Ke as CommandManager, | ||
J as CommandsReady, | ||
L as ConfigReady, | ||
Ie as CommandManager, | ||
Y as CommandsReady, | ||
W as ConfigReady, | ||
Oe as Editor, | ||
q as EditorStateReady, | ||
J as EditorStateReady, | ||
pt as EditorStatus, | ||
ne as EditorViewReady, | ||
oe as EditorViewReady, | ||
M as InitReady, | ||
W as ParserReady, | ||
$ as ParserReady, | ||
R as SchemaReady, | ||
$ as SerializerReady, | ||
Ae as commands, | ||
H as SerializerReady, | ||
Ve as commands, | ||
je as commandsCtx, | ||
me as commandsTimerCtx, | ||
x as commandsTimerCtx, | ||
ot as config, | ||
Et as createCmdKey, | ||
re as defaultValueCtx, | ||
se as defaultValueCtx, | ||
ke as editorCtx, | ||
_e as editorState, | ||
Ke as editorState, | ||
V as editorStateCtx, | ||
se as editorStateOptionsCtx, | ||
ie as editorStateTimerCtx, | ||
ze as editorView, | ||
H as editorViewCtx, | ||
ae as editorViewOptionsCtx, | ||
oe as editorViewTimerCtx, | ||
ie as editorStateOptionsCtx, | ||
ne as editorStateTimerCtx, | ||
Ae as editorView, | ||
L as editorViewCtx, | ||
ce as editorViewOptionsCtx, | ||
ae as editorViewTimerCtx, | ||
ct as getDoc, | ||
@@ -404,5 +404,5 @@ at as init, | ||
X as nodesCtx, | ||
Ve as parser, | ||
Y as parserCtx, | ||
x as parserTimerCtx, | ||
Ne as parser, | ||
q as parserCtx, | ||
ee as parserTimerCtx, | ||
N as prosePluginsCtx, | ||
@@ -413,3 +413,3 @@ P as remarkCtx, | ||
ge as rootAttrsCtx, | ||
ce as rootCtx, | ||
me as rootCtx, | ||
we as rootDOMCtx, | ||
@@ -419,6 +419,6 @@ Ee as schema, | ||
U as schemaTimerCtx, | ||
Ne as serializer, | ||
te as serializerCtx, | ||
ee as serializerTimerCtx | ||
ze as serializer, | ||
re as serializerCtx, | ||
te as serializerTimerCtx | ||
}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -16,3 +16,2 @@ import type { MilkdownPlugin, TimerType } from '@milkdown/ctx'; | ||
export declare const defaultValueCtx: import("@milkdown/ctx").SliceType<DefaultValue, "defaultValue">; | ||
export declare const editorStateCtx: import("@milkdown/ctx").SliceType<EditorState, "editorState">; | ||
export declare const editorStateOptionsCtx: import("@milkdown/ctx").SliceType<StateOptionsOverride, string>; | ||
@@ -19,0 +18,0 @@ export declare const editorStateTimerCtx: import("@milkdown/ctx").SliceType<TimerType[], "editorStateTimer">; |
import type { MilkdownPlugin, TimerType } from '@milkdown/ctx'; | ||
import type { DirectEditorProps } from '@milkdown/prose/view'; | ||
import { EditorView } from '@milkdown/prose/view'; | ||
type EditorOptions = Omit<DirectEditorProps, 'state'>; | ||
type RootType = Node | undefined | null | string; | ||
export declare const EditorViewReady: TimerType; | ||
export declare const editorViewCtx: import("@milkdown/ctx").SliceType<EditorView, "editorView">; | ||
export declare const editorViewTimerCtx: import("@milkdown/ctx").SliceType<TimerType[], "editorViewTimer">; | ||
@@ -9,0 +7,0 @@ export declare const editorViewOptionsCtx: import("@milkdown/ctx").SliceType<Partial<EditorOptions>, "editorViewOptions">; |
@@ -0,1 +1,2 @@ | ||
export * from './atoms'; | ||
export * from './commands'; | ||
@@ -2,0 +3,0 @@ export * from './config'; |
@@ -1,22 +0,5 @@ | ||
import type { MilkdownPlugin, SliceType, TimerType } from '@milkdown/ctx'; | ||
import type { InputRule } from '@milkdown/prose/inputrules'; | ||
import type { Plugin } from '@milkdown/prose/state'; | ||
import type { MarkViewConstructor, NodeViewConstructor } from '@milkdown/prose/view'; | ||
import type { RemarkParser, RemarkPlugin } from '@milkdown/transformer'; | ||
import type { Options } from 'remark-stringify'; | ||
import type { MilkdownPlugin } from '@milkdown/ctx'; | ||
import type { Editor } from '../editor'; | ||
export declare const InitReady: TimerType; | ||
export declare const initTimerCtx: SliceType<TimerType[], "initTimer">; | ||
export declare const editorCtx: SliceType<Editor, "editor">; | ||
export declare const inputRulesCtx: SliceType<InputRule[], "inputRules">; | ||
export declare const prosePluginsCtx: SliceType<Plugin<any>[], "prosePlugins">; | ||
export declare const remarkPluginsCtx: SliceType<RemarkPlugin<Record<string, unknown>>[], "remarkPlugins">; | ||
type NodeView = [nodeId: string, view: NodeViewConstructor]; | ||
export declare const nodeViewCtx: SliceType<NodeView[], "nodeView">; | ||
type MarkView = [nodeId: string, view: MarkViewConstructor]; | ||
export declare const markViewCtx: SliceType<MarkView[], "markView">; | ||
export declare const remarkCtx: SliceType<RemarkParser, 'remark'>; | ||
export declare const remarkStringifyOptionsCtx: SliceType<Options, "remarkStringifyOptions">; | ||
export declare const InitReady: import("@milkdown/ctx").TimerType; | ||
export declare function init(editor: Editor): MilkdownPlugin; | ||
export {}; | ||
//# sourceMappingURL=init.d.ts.map |
{ | ||
"name": "@milkdown/core", | ||
"type": "module", | ||
"version": "7.3.6", | ||
"version": "7.4.0", | ||
"license": "MIT", | ||
@@ -42,8 +42,8 @@ "repository": { | ||
"unified": "^11.0.3", | ||
"@milkdown/exception": "7.3.6" | ||
"@milkdown/exception": "7.4.0" | ||
}, | ||
"devDependencies": { | ||
"@milkdown/ctx": "7.3.6", | ||
"@milkdown/prose": "7.3.6", | ||
"@milkdown/transformer": "7.3.6" | ||
"@milkdown/ctx": "7.4.0", | ||
"@milkdown/prose": "7.4.0", | ||
"@milkdown/transformer": "7.4.0" | ||
}, | ||
@@ -50,0 +50,0 @@ "nx": { |
@@ -1,3 +0,2 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
export * from './utils' | ||
export * from './remark-handlers' |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { Options } from 'remark-stringify' | ||
@@ -3,0 +2,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { Meta, MilkdownPlugin } from '@milkdown/ctx' | ||
@@ -3,0 +2,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { CtxRunner, MilkdownPlugin, Telemetry } from '@milkdown/ctx' | ||
@@ -3,0 +2,0 @@ import { Clock, Container, Ctx } from '@milkdown/ctx' |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
export * from './editor' |
@@ -1,3 +0,2 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
export * from './editor' | ||
export * from './internal-plugin' |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { Ctx, MilkdownPlugin, SliceType } from '@milkdown/ctx' | ||
@@ -8,4 +7,4 @@ import { Container, createSlice, createTimer } from '@milkdown/ctx' | ||
import { withMeta } from '../__internal__' | ||
import { editorViewCtx } from './editor-view' | ||
import { SchemaReady } from './schema' | ||
import { editorViewCtx } from './atoms' | ||
@@ -12,0 +11,0 @@ /// @internal |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { Ctx, MilkdownPlugin } from '@milkdown/ctx' | ||
@@ -3,0 +2,0 @@ import { createTimer } from '@milkdown/ctx' |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { MilkdownPlugin, TimerType } from '@milkdown/ctx' | ||
@@ -16,7 +15,7 @@ import { createSlice, createTimer } from '@milkdown/ctx' | ||
import { withMeta } from '../__internal__' | ||
import { inputRulesCtx, prosePluginsCtx } from './init' | ||
import { ParserReady, parserCtx } from './parser' | ||
import { schemaCtx } from './schema' | ||
import { SerializerReady } from './serializer' | ||
import { CommandsReady } from '.' | ||
import { CommandsReady } from './commands' | ||
import { editorStateCtx, inputRulesCtx, prosePluginsCtx } from './atoms' | ||
@@ -32,5 +31,2 @@ /// @internal | ||
/// A slice which contains the editor state. | ||
export const editorStateCtx = createSlice({} as EditorState, 'editorState') | ||
/// A slice which contains the options which is used to create the editor state. | ||
@@ -37,0 +33,0 @@ export const editorStateOptionsCtx = createSlice<StateOptionsOverride>(x => x, 'stateOptions') |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { Ctx, MilkdownPlugin, TimerType } from '@milkdown/ctx' | ||
@@ -9,4 +8,5 @@ import { createSlice, createTimer } from '@milkdown/ctx' | ||
import { withMeta } from '../__internal__' | ||
import { EditorStateReady, editorStateCtx } from './editor-state' | ||
import { InitReady, markViewCtx, nodeViewCtx, prosePluginsCtx } from './init' | ||
import { EditorStateReady } from './editor-state' | ||
import { InitReady } from './init' | ||
import { editorStateCtx, editorViewCtx, markViewCtx, nodeViewCtx, prosePluginsCtx } from './atoms' | ||
@@ -20,5 +20,2 @@ type EditorOptions = Omit<DirectEditorProps, 'state'> | ||
/// A slice which contains the editor view instance. | ||
export const editorViewCtx = createSlice({} as EditorView, 'editorView') | ||
/// A slice which stores timers that need to be waited for before starting to run the plugin. | ||
@@ -25,0 +22,0 @@ /// By default, it's `[EditorStateReady]`. |
@@ -1,2 +0,2 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
export * from './atoms' | ||
export * from './commands' | ||
@@ -3,0 +3,0 @@ export * from './config' |
@@ -1,10 +0,4 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { MilkdownPlugin, SliceType, TimerType } from '@milkdown/ctx' | ||
import { createSlice, createTimer } from '@milkdown/ctx' | ||
import type { InputRule } from '@milkdown/prose/inputrules' | ||
import type { Plugin } from '@milkdown/prose/state' | ||
import type { MarkViewConstructor, NodeViewConstructor } from '@milkdown/prose/view' | ||
import type { RemarkParser, RemarkPlugin } from '@milkdown/transformer' | ||
import type { MilkdownPlugin } from '@milkdown/ctx' | ||
import { createTimer } from '@milkdown/ctx' | ||
import remarkParse from 'remark-parse' | ||
import type { Options } from 'remark-stringify' | ||
import remarkStringify from 'remark-stringify' | ||
@@ -16,2 +10,13 @@ import { unified } from 'unified' | ||
import { ConfigReady } from './config' | ||
import { | ||
editorCtx, | ||
initTimerCtx, | ||
inputRulesCtx, | ||
markViewCtx, | ||
nodeViewCtx, | ||
prosePluginsCtx, | ||
remarkCtx, | ||
remarkPluginsCtx, | ||
remarkStringifyOptionsCtx, | ||
} from './atoms' | ||
@@ -21,36 +26,2 @@ /// The timer which will be resolved when the init plugin is ready. | ||
/// A slice which stores timers that need to be waited for before starting to run the plugin. | ||
/// By default, it's `[ConfigReady]`. | ||
export const initTimerCtx = createSlice([] as TimerType[], 'initTimer') | ||
/// A slice which stores the editor instance. | ||
export const editorCtx = createSlice({} as Editor, 'editor') | ||
/// A slice which stores the input rules. | ||
export const inputRulesCtx = createSlice([] as InputRule[], 'inputRules') | ||
/// A slice which stores the prosemirror plugins. | ||
export const prosePluginsCtx = createSlice([] as Plugin[], 'prosePlugins') | ||
/// A slice which stores the remark plugins. | ||
export const remarkPluginsCtx = createSlice([] as RemarkPlugin[], 'remarkPlugins') | ||
type NodeView = [nodeId: string, view: NodeViewConstructor] | ||
/// A slice which stores the prosemirror node views. | ||
export const nodeViewCtx = createSlice([] as NodeView[], 'nodeView') | ||
type MarkView = [nodeId: string, view: MarkViewConstructor] | ||
/// A slice which stores the prosemirror mark views. | ||
export const markViewCtx = createSlice([] as MarkView[], 'markView') | ||
/// A slice which stores the remark instance. | ||
export const remarkCtx: SliceType<RemarkParser, 'remark'> = createSlice(unified().use(remarkParse).use(remarkStringify), 'remark') | ||
/// A slice which stores the remark stringify options. | ||
export const remarkStringifyOptionsCtx = createSlice({ | ||
handlers: remarkHandlers, | ||
} as Options, 'remarkStringifyOptions') | ||
/// The init plugin. | ||
@@ -57,0 +28,0 @@ /// This plugin prepare slices that needed by other plugins. And create a remark instance. |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { MilkdownPlugin, TimerType } from '@milkdown/ctx' | ||
@@ -9,3 +8,3 @@ import { createSlice, createTimer } from '@milkdown/ctx' | ||
import { withMeta } from '../__internal__' | ||
import { remarkCtx } from './init' | ||
import { remarkCtx } from './atoms' | ||
import { SchemaReady, schemaCtx } from './schema' | ||
@@ -12,0 +11,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { MilkdownPlugin, TimerType } from '@milkdown/ctx' | ||
@@ -8,3 +7,4 @@ import { createSlice, createTimer } from '@milkdown/ctx' | ||
import { withMeta } from '../__internal__' | ||
import { InitReady, remarkCtx, remarkPluginsCtx } from '.' | ||
import { InitReady } from './init' | ||
import { remarkCtx, remarkPluginsCtx } from './atoms' | ||
@@ -11,0 +11,0 @@ /// The timer which will be resolved when the schema plugin is ready. |
@@ -1,2 +0,1 @@ | ||
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { MilkdownPlugin, TimerType } from '@milkdown/ctx' | ||
@@ -9,3 +8,3 @@ import { createSlice, createTimer } from '@milkdown/ctx' | ||
import { withMeta } from '../__internal__' | ||
import { remarkCtx } from './init' | ||
import { remarkCtx } from './atoms' | ||
import { SchemaReady, schemaCtx } from './schema' | ||
@@ -12,0 +11,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
118947
53
1428
+ Added@milkdown/exception@7.4.0(transitive)
- Removed@milkdown/exception@7.3.6(transitive)
Updated@milkdown/exception@7.4.0