Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@milkdown/preset-gfm

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@milkdown/preset-gfm - npm Package Compare versions

Comparing version 7.2.4 to 7.3.0

306

./lib/index.es.js
import { expectDomTypeError as O } from "@milkdown/exception";
import { paragraphSchema as Q, listItemSchema as Ie } from "@milkdown/preset-commonmark";
import { InputRule as Y } from "@milkdown/prose/inputrules";
import { $markAttr as $e, $markSchema as _e, $command as h, $useKeymap as ee, $nodeSchema as k, $inputRule as te, $prose as B, $remark as Pe } from "@milkdown/utils";
import { commandsCtx as A } from "@milkdown/core";
import { TextSelection as Ee, Selection as oe, PluginKey as De, Plugin as Oe } from "@milkdown/prose/state";
import { TableMap as g, CellSelection as y, tableNodes as Be, goToNextCell as ne, isInTable as N, deleteTable as Ke, deleteColumn as He, deleteRow as Le, addColumnBefore as Fe, addColumnAfter as We, selectedRect as le, setCellAttr as ze, columnResizing as Ge, tableEditing as je } from "@milkdown/prose/tables";
import { findParentNode as Ze, cloneTr as M, browser as V } from "@milkdown/prose";
import { paragraphSchema as Y, listItemSchema as Ie } from "@milkdown/preset-commonmark";
import { InputRule as ee } from "@milkdown/prose/inputrules";
import { $markAttr as $e, $markSchema as Pe, $command as g, $useKeymap as te, $nodeSchema as k, $inputRule as oe, $prose as B, $remark as _e } from "@milkdown/utils";
import { commandsCtx as M } from "@milkdown/core";
import { TextSelection as Ee, Selection as ne, PluginKey as De, Plugin as Oe } from "@milkdown/prose/state";
import { TableMap as h, CellSelection as y, tableNodes as Be, goToNextCell as le, isInTable as N, deleteTable as Fe, deleteColumn as Ke, deleteRow as He, addColumnBefore as Le, addColumnAfter as We, selectedRect as re, setCellAttr as Ge, columnResizing as ze, tableEditing as je } from "@milkdown/prose/tables";
import { findParentNode as Ze, cloneTr as A, browser as U } from "@milkdown/prose";
import { toggleMark as Ve } from "@milkdown/prose/commands";

@@ -16,8 +16,8 @@ import Ue from "remark-gfm";

}
}), e), K = $e("strike_through");
d(K, {
}), e), F = $e("strike_through");
d(F, {
displayName: "Attr<strikethrough>",
group: "Strikethrough"
});
const x = _e("strike_through", (e) => ({
const x = Pe("strike_through", (e) => ({
parseDOM: [

@@ -27,3 +27,3 @@ { tag: "del" },

],
toDOM: (t) => ["del", e.get(K.key)(t)],
toDOM: (t) => ["del", e.get(F.key)(t)],
parseMarkdown: {

@@ -50,25 +50,25 @@ match: (t) => t.type === "delete",

});
const H = h("ToggleStrikeThrough", (e) => () => Ve(x.type(e)));
d(H, {
const K = g("ToggleStrikeThrough", (e) => () => Ve(x.type(e)));
d(K, {
displayName: "Command<ToggleStrikethrough>",
group: "Strikethrough"
});
const L = ee("strikeThroughKeymap", {
const H = te("strikeThroughKeymap", {
ToggleStrikethrough: {
shortcuts: "Mod-Alt-x",
command: (e) => {
const t = e.get(A);
return () => t.call(H.key);
const t = e.get(M);
return () => t.call(K.key);
}
}
});
d(L.ctx, {
d(H.ctx, {
displayName: "KeymapCtx<strikethrough>",
group: "Strikethrough"
});
d(L.shortcuts, {
d(H.shortcuts, {
displayName: "Keymap<strikethrough>",
group: "Strikethrough"
});
const re = (e, t = 3, n = 3) => {
const ae = (e, t = 3, n = 3) => {
const o = Array(n).fill(0).map(() => R.type(e).createAndFill()), l = Array(n).fill(0).map(() => I.type(e).createAndFill()), r = Array(t).fill(0).map((s, c) => S.type(e).create(null, c === 0 ? l : o));

@@ -80,3 +80,3 @@ return T.type(e).create(null, r);

return;
const o = g.get(n.node);
const o = h.get(n.node);
if (!(e < 0 || e >= o.width))

@@ -98,3 +98,3 @@ return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {

return;
const o = g.get(n.node);
const o = h.get(n.node);
if (!(e < 0 || e >= o.height))

@@ -116,3 +116,3 @@ return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {

return;
const n = g.get(t.node);
const n = h.get(t.node);
return n.cellsInRect({

@@ -133,3 +133,3 @@ left: 0,

const l = e.doc.resolve(o.pos);
return M(e.setSelection(new y(l, n)));
return A(e.setSelection(new y(l, n)));
}

@@ -139,3 +139,3 @@ }

};
function ae(e, t, { map: n, tableStart: o, table: l }, r) {
function se(e, t, { map: n, tableStart: o, table: l }, r) {
const s = Array(r).fill(0).reduce((i, m, a) => i + l.child(a).nodeSize, o), c = Array(n.width).fill(0).map((i, m) => {

@@ -147,6 +147,6 @@ const a = l.nodeAt(n.map[m]);

}
const se = (e) => (t) => (n) => {
const ce = (e) => (t) => (n) => {
const o = w(n.selection), l = e === "row";
if (o) {
const r = g.get(o.node);
const r = h.get(o.node);
if (t >= 0 && t < (l ? r.height : r.width)) {

@@ -158,8 +158,8 @@ const s = r.positionAt(

), c = n.doc.resolve(o.start + s), i = l ? y.rowSelection : y.colSelection, m = r.positionAt(l ? t : 0, l ? 0 : t, o.node), a = n.doc.resolve(o.start + m);
return M(n.setSelection(i(c, a)));
return A(n.setSelection(i(c, a)));
}
}
return n;
}, Je = se("row"), Qe = se("col"), U = (e) => e[0].map((t, n) => e.map((o) => o[n])), ce = (e, t) => {
const n = [], o = g.get(e);
}, Je = ce("row"), Qe = ce("col"), X = (e) => e[0].map((t, n) => e.map((o) => o[n])), ie = (e, t) => {
const n = [], o = h.get(e);
for (let r = 0; r < o.height; r++) {

@@ -184,4 +184,4 @@ const s = e.child(r), c = [];

);
}, ie = (e) => {
const t = g.get(e), n = [];
}, de = (e) => {
const t = h.get(e), n = [];
for (let o = 0; o < t.height; o++) {

@@ -200,3 +200,3 @@ const l = [], r = {};

return n;
}, de = (e, t, n, o) => {
}, me = (e, t, n, o) => {
const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;

@@ -206,8 +206,8 @@ let c;

}, Ye = (e, t, n, o) => {
let l = U(ie(e.node));
return l = de(l, t, n, o), l = U(l), ce(e.node, l);
let l = X(de(e.node));
return l = me(l, t, n, o), l = X(l), ie(e.node, l);
}, et = (e, t, n, o) => {
let l = ie(e.node);
return l = de(l, t, n, o), ce(e.node, l);
}, X = (e, t) => {
let l = de(e.node);
return l = me(l, t, n, o), ie(e.node, l);
}, q = (e, t) => {
let n = e, o = e;

@@ -252,3 +252,3 @@ for (let a = e; a >= 0; a--) {

return { $anchor: c, $head: m, indexes: l };
}, q = (e, t) => {
}, J = (e, t) => {
let n = e, o = e;

@@ -292,3 +292,3 @@ for (let a = e; a >= 0; a--)

return e;
const { indexes: r } = X(t, e), { indexes: s } = X(n, e);
const { indexes: r } = q(t, e), { indexes: s } = q(n, e);
if (r.includes(n))

@@ -301,3 +301,3 @@ return e;

0
), i = M(e).replaceWith(
), i = A(e).replaceWith(
l.pos,

@@ -309,4 +309,4 @@ l.pos + l.node.nodeSize,

return i;
const m = g.get(c), a = l.start, u = n, p = m.positionAt(m.height - 1, u, c), f = i.doc.resolve(a + p), $ = y.colSelection, _ = m.positionAt(0, u, c), P = i.doc.resolve(a + _);
return i.setSelection($(f, P));
const m = h.get(c), a = l.start, u = n, p = m.positionAt(m.height - 1, u, c), f = i.doc.resolve(a + p), $ = y.colSelection, P = m.positionAt(0, u, c), _ = i.doc.resolve(a + P);
return i.setSelection($(f, _));
}

@@ -317,3 +317,3 @@ function ot(e, t, n, o = !0) {

return e;
const { indexes: r } = q(t, e), { indexes: s } = q(n, e);
const { indexes: r } = J(t, e), { indexes: s } = J(n, e);
if (r.includes(n))

@@ -326,3 +326,3 @@ return e;

0
), i = M(e).replaceWith(
), i = A(e).replaceWith(
l.pos,

@@ -334,4 +334,4 @@ l.pos + l.node.nodeSize,

return i;
const m = g.get(c), a = l.start, u = n, p = m.positionAt(u, m.width - 1, c), f = i.doc.resolve(a + p), $ = y.rowSelection, _ = m.positionAt(u, 0, c), P = i.doc.resolve(a + _);
return i.setSelection($(f, P));
const m = h.get(c), a = l.start, u = n, p = m.positionAt(u, m.width - 1, c), f = i.doc.resolve(a + p), $ = y.rowSelection, P = m.positionAt(u, 0, c), _ = i.doc.resolve(a + P);
return i.setSelection($(f, _));
}

@@ -461,3 +461,3 @@ const v = Be({

});
const me = te((e) => new Y(
const ue = oe((e) => new ee(
/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,

@@ -469,3 +469,3 @@ (t, n, o, l) => {

return null;
const s = re(
const s = ae(
e,

@@ -478,12 +478,12 @@ Number((i = n.groups) == null ? void 0 : i.row),

));
d(me, {
d(ue, {
displayName: "InputRule<insertTableInputRule>",
group: "Table"
});
const F = h("GoToPrevTableCell", () => () => ne(-1));
d(F, {
const L = g("GoToPrevTableCell", () => () => le(-1));
d(L, {
displayName: "Command<goToPrevTableCellCommand>",
group: "Table"
});
const W = h("GoToNextTableCell", () => () => ne(1));
const W = g("GoToNextTableCell", () => () => le(1));
d(W, {

@@ -493,37 +493,37 @@ displayName: "Command<goToNextTableCellCommand>",

});
const z = h("BreakTable", (e) => () => (t, n) => {
const G = g("BreakTable", (e) => () => (t, n) => {
if (!N(t))
return !1;
const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, Q.type(e).createAndFill());
return r.setSelection(oe.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, Y.type(e).createAndFill());
return r.setSelection(ne.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
});
d(z, {
d(G, {
displayName: "Command<breakTableCommand>",
group: "Table"
});
const ue = h("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
const { selection: r, tr: s } = o, { from: c } = r, i = re(e, t, n), m = s.replaceSelectionWith(i), a = oe.findFrom(m.doc.resolve(c), 1, !0);
const pe = g("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
const { selection: r, tr: s } = o, { from: c } = r, i = ae(e, t, n), m = s.replaceSelectionWith(i), a = ne.findFrom(m.doc.resolve(c), 1, !0);
return a && m.setSelection(a), l == null || l(m), !0;
});
d(ue, {
d(pe, {
displayName: "Command<insertTableCommand>",
group: "Table"
});
const pe = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
const fe = g("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
const { tr: l } = n;
return !!(o == null ? void 0 : o(ot(l, e ?? 0, t ?? 0, !0)));
});
d(pe, {
d(fe, {
displayName: "Command<moveRowCommand>",
group: "Table"
});
const fe = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
const ge = g("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
const { tr: l } = n;
return !!(o == null ? void 0 : o(tt(l, e ?? 0, t ?? 0, !0)));
});
d(fe, {
d(ge, {
displayName: "Command<moveColCommand>",
group: "Table"
});
const he = h("SelectRow", () => (e = 0) => (t, n) => {
const he = g("SelectRow", () => (e = 0) => (t, n) => {
const { tr: o } = t;

@@ -536,19 +536,19 @@ return !!(n == null ? void 0 : n(Je(e)(o)));

});
const ge = h("SelectCol", () => (e = 0) => (t, n) => {
const be = g("SelectCol", () => (e = 0) => (t, n) => {
const { tr: o } = t;
return !!(n == null ? void 0 : n(Qe(e)(o)));
});
d(ge, {
d(be, {
displayName: "Command<selectColCommand>",
group: "Table"
});
const be = h("SelectTable", () => () => (e, t) => {
const Ce = g("SelectTable", () => () => (e, t) => {
const { tr: n } = e;
return !!(t == null ? void 0 : t(qe(n)));
});
d(be, {
d(Ce, {
displayName: "Command<selectTableCommand>",
group: "Table"
});
const Ce = h("DeleteSelectedCells", () => () => (e, t) => {
const ye = g("DeleteSelectedCells", () => () => (e, t) => {
const { selection: n } = e;

@@ -558,54 +558,54 @@ if (!(n instanceof y))

const o = n.isRowSelection(), l = n.isColSelection();
return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
return o && l ? Fe(e, t) : l ? Ke(e, t) : He(e, t);
});
d(Ce, {
d(ye, {
displayName: "Command<deleteSelectedCellsCommand>",
group: "Table"
});
const ye = h("AddColBefore", () => () => Fe);
d(ye, {
const ke = g("AddColBefore", () => () => Le);
d(ke, {
displayName: "Command<addColBeforeCommand>",
group: "Table"
});
const ke = h("AddColAfter", () => () => We);
d(ke, {
const we = g("AddColAfter", () => () => We);
d(we, {
displayName: "Command<addColAfterCommand>",
group: "Table"
});
const we = h("AddRowBefore", (e) => () => (t, n) => {
const Ne = g("AddRowBefore", (e) => () => (t, n) => {
if (!N(t))
return !1;
if (n) {
const o = le(t);
n(ae(e, t.tr, o, o.top));
const o = re(t);
n(se(e, t.tr, o, o.top));
}
return !0;
});
d(we, {
d(Ne, {
displayName: "Command<addRowBeforeCommand>",
group: "Table"
});
const Ne = h("AddRowAfter", (e) => () => (t, n) => {
const Te = g("AddRowAfter", (e) => () => (t, n) => {
if (!N(t))
return !1;
if (n) {
const o = le(t);
n(ae(e, t.tr, o, o.bottom));
const o = re(t);
n(se(e, t.tr, o, o.bottom));
}
return !0;
});
d(Ne, {
d(Te, {
displayName: "Command<addRowAfterCommand>",
group: "Table"
});
const Te = h("SetAlign", () => (e = "left") => ze("alignment", e));
d(Te, {
const Se = g("SetAlign", () => (e = "left") => Ge("alignment", e));
d(Se, {
displayName: "Command<setAlignCommand>",
group: "Table"
});
const G = ee("tableKeymap", {
const z = te("tableKeymap", {
NextCell: {
shortcuts: ["Mod-]", "Tab"],
command: (e) => {
const t = e.get(A);
const t = e.get(M);
return () => t.call(W.key);

@@ -617,4 +617,4 @@ }

command: (e) => {
const t = e.get(A);
return () => t.call(F.key);
const t = e.get(M);
return () => t.call(L.key);
}

@@ -625,16 +625,16 @@ },

command: (e) => {
const t = e.get(A);
return () => t.call(z.key);
const t = e.get(M);
return () => t.call(G.key);
}
}
});
d(G.ctx, {
d(z.ctx, {
displayName: "KeymapCtx<table>",
group: "Table"
});
d(G.shortcuts, {
d(z.shortcuts, {
displayName: "Keymap<table>",
group: "Table"
});
const E = "footnote_definition", J = "footnoteDefinition", j = k("footnote_definition", () => ({
const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_definition", () => ({
group: "block",

@@ -675,3 +675,3 @@ content: "block+",

parseMarkdown: {
match: ({ type: e }) => e === J,
match: ({ type: e }) => e === Q,
runner: (e, t, n) => {

@@ -686,3 +686,3 @@ e.openNode(n, {

runner: (e, t) => {
e.openNode(J, void 0, {
e.openNode(Q, void 0, {
label: t.attrs.label,

@@ -761,3 +761,3 @@ identifier: t.attrs.label

});
const Se = Ie.extendSchema((e) => (t) => {
const Re = Ie.extendSchema((e) => (t) => {
const n = e(t);

@@ -823,7 +823,7 @@ return {

});
d(Se, {
d(Re, {
displayName: "NodeSchema<listItem>",
group: "ListItem"
});
const Re = te(() => new Y(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
const Me = oe(() => new ee(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
var a;

@@ -839,3 +839,3 @@ const l = e.doc.resolve(n);

}));
d(Re, {
d(Me, {
displayName: "InputRule<wrapInTaskListInputRule>",

@@ -845,9 +845,9 @@ group: "ListItem"

const nt = [
L,
G
H,
z
].flat(), lt = [
me,
Re
ue,
Me
], Ae = B((e) => {
const t = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n = (l) => l.type === Q.type(e), o = (l) => n(l) && l.nodeSize === 2;
const t = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n = (l) => l.type === Y.type(e), o = (l) => n(l) && l.nodeSize === 2;
return new Oe({

@@ -859,7 +859,7 @@ key: t,

const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
return V.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("⁠", m.start())), !1;
return U.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("⁠", m.start())), !1;
},
compositionend(l) {
const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
return V.safari && N(r) && i.empty && n(m.parent) && m.parent.textContent.startsWith("⁠") && s(c.delete(m.start(), m.start() + 1)), !1;
return U.safari && N(r) && i.empty && n(m.parent) && m.parent.textContent.startsWith("⁠") && s(c.delete(m.start(), m.start() + 1)), !1;
}

@@ -874,24 +874,28 @@ }

});
const Me = B(() => Ge({}));
d(Me, {
const xe = B(() => ze({}));
d(xe, {
displayName: "Prose<columnResizingPlugin>",
group: "Prose"
});
const xe = B(() => je());
d(xe, {
const ve = B(() => je());
d(ve, {
displayName: "Prose<tableEditingPlugin>",
group: "Prose"
});
const ve = Pe(() => Ue);
d(ve, {
const V = _e("remarkGFM", () => Ue);
d(V.plugin, {
displayName: "Remark<remarkGFMPlugin>",
group: "Remark"
});
d(V.options, {
displayName: "RemarkConfig<remarkGFMPlugin>",
group: "Remark"
});
const rt = [
Ae,
Me,
xe,
ve
], at = [
Se,
ve,
V
].flat(), at = [
Re,
T,

@@ -903,33 +907,35 @@ S,

Z,
K,
F,
x
].flat(), st = [
W,
F,
z,
ue,
L,
G,
pe,
fe,
ge,
he,
ge,
be,
Ce,
we,
ye,
Ne,
ye,
Te,
ke,
Te,
H
we,
Se,
K
], Ct = [at, lt, nt, rt, st].flat();
export {
ke as addColAfterCommand,
ye as addColBeforeCommand,
Ne as addRowAfterCommand,
we as addRowBeforeCommand,
ae as addRowWithAlignment,
z as breakTableCommand,
we as addColAfterCommand,
ke as addColBeforeCommand,
Te as addRowAfterCommand,
Ne as addRowBeforeCommand,
se as addRowWithAlignment,
Ae as autoInsertZeroSpaceInTablePlugin,
G as breakTableCommand,
xe as columnResizingPlugin,
st as commands,
re as createTable,
Ce as deleteSelectedCellsCommand,
Se as extendListItemSchemaForTask,
ae as createTable,
ye as deleteSelectedCellsCommand,
Re as extendListItemSchemaForTask,
w as findTable,

@@ -943,32 +949,34 @@ j as footnoteDefinitionSchema,

W as goToNextTableCellCommand,
F as goToPrevTableCellCommand,
L as goToPrevTableCellCommand,
lt as inputrules,
ue as insertTableCommand,
me as insertTableInputRule,
pe as insertTableCommand,
ue as insertTableInputRule,
nt as keymap,
tt as moveCol,
fe as moveColCommand,
ge as moveColCommand,
ot as moveRow,
pe as moveRowCommand,
fe as moveRowCommand,
rt as plugins,
V as remarkGFMPlugin,
at as schema,
Qe as selectCol,
ge as selectColCommand,
se as selectLine,
be as selectColCommand,
ce as selectLine,
Je as selectRow,
he as selectRowCommand,
qe as selectTable,
be as selectTableCommand,
Te as setAlignCommand,
K as strikethroughAttr,
L as strikethroughKeymap,
Ce as selectTableCommand,
Se as setAlignCommand,
F as strikethroughAttr,
H as strikethroughKeymap,
x as strikethroughSchema,
R as tableCellSchema,
ve as tableEditingPlugin,
I as tableHeaderSchema,
G as tableKeymap,
z as tableKeymap,
S as tableRowSchema,
T as tableSchema,
H as toggleStrikethroughCommand,
Re as wrapInTaskListInputRule
K as toggleStrikethroughCommand,
Me as wrapInTaskListInputRule
};
//# sourceMappingURL=index.es.js.map
export * from './node';
export * from './mark';
export * from './plugin';
export * from './composed';
export declare const gfm: import("@milkdown/ctx").MilkdownPlugin[];
//# sourceMappingURL=index.d.ts.map
import { expectDomTypeError as O } from "@milkdown/exception";
import { paragraphSchema as Q, listItemSchema as Ie } from "@milkdown/preset-commonmark";
import { InputRule as Y } from "@milkdown/prose/inputrules";
import { $markAttr as $e, $markSchema as _e, $command as h, $useKeymap as ee, $nodeSchema as k, $inputRule as te, $prose as B, $remark as Pe } from "@milkdown/utils";
import { commandsCtx as A } from "@milkdown/core";
import { TextSelection as Ee, Selection as oe, PluginKey as De, Plugin as Oe } from "@milkdown/prose/state";
import { TableMap as g, CellSelection as y, tableNodes as Be, goToNextCell as ne, isInTable as N, deleteTable as Ke, deleteColumn as He, deleteRow as Le, addColumnBefore as Fe, addColumnAfter as We, selectedRect as le, setCellAttr as ze, columnResizing as Ge, tableEditing as je } from "@milkdown/prose/tables";
import { findParentNode as Ze, cloneTr as M, browser as V } from "@milkdown/prose";
import { paragraphSchema as Y, listItemSchema as Ie } from "@milkdown/preset-commonmark";
import { InputRule as ee } from "@milkdown/prose/inputrules";
import { $markAttr as $e, $markSchema as Pe, $command as g, $useKeymap as te, $nodeSchema as k, $inputRule as oe, $prose as B, $remark as _e } from "@milkdown/utils";
import { commandsCtx as M } from "@milkdown/core";
import { TextSelection as Ee, Selection as ne, PluginKey as De, Plugin as Oe } from "@milkdown/prose/state";
import { TableMap as h, CellSelection as y, tableNodes as Be, goToNextCell as le, isInTable as N, deleteTable as Fe, deleteColumn as Ke, deleteRow as He, addColumnBefore as Le, addColumnAfter as We, selectedRect as re, setCellAttr as Ge, columnResizing as ze, tableEditing as je } from "@milkdown/prose/tables";
import { findParentNode as Ze, cloneTr as A, browser as U } from "@milkdown/prose";
import { toggleMark as Ve } from "@milkdown/prose/commands";

@@ -16,8 +16,8 @@ import Ue from "remark-gfm";

}
}), e), K = $e("strike_through");
d(K, {
}), e), F = $e("strike_through");
d(F, {
displayName: "Attr<strikethrough>",
group: "Strikethrough"
});
const x = _e("strike_through", (e) => ({
const x = Pe("strike_through", (e) => ({
parseDOM: [

@@ -27,3 +27,3 @@ { tag: "del" },

],
toDOM: (t) => ["del", e.get(K.key)(t)],
toDOM: (t) => ["del", e.get(F.key)(t)],
parseMarkdown: {

@@ -50,25 +50,25 @@ match: (t) => t.type === "delete",

});
const H = h("ToggleStrikeThrough", (e) => () => Ve(x.type(e)));
d(H, {
const K = g("ToggleStrikeThrough", (e) => () => Ve(x.type(e)));
d(K, {
displayName: "Command<ToggleStrikethrough>",
group: "Strikethrough"
});
const L = ee("strikeThroughKeymap", {
const H = te("strikeThroughKeymap", {
ToggleStrikethrough: {
shortcuts: "Mod-Alt-x",
command: (e) => {
const t = e.get(A);
return () => t.call(H.key);
const t = e.get(M);
return () => t.call(K.key);
}
}
});
d(L.ctx, {
d(H.ctx, {
displayName: "KeymapCtx<strikethrough>",
group: "Strikethrough"
});
d(L.shortcuts, {
d(H.shortcuts, {
displayName: "Keymap<strikethrough>",
group: "Strikethrough"
});
const re = (e, t = 3, n = 3) => {
const ae = (e, t = 3, n = 3) => {
const o = Array(n).fill(0).map(() => R.type(e).createAndFill()), l = Array(n).fill(0).map(() => I.type(e).createAndFill()), r = Array(t).fill(0).map((s, c) => S.type(e).create(null, c === 0 ? l : o));

@@ -80,3 +80,3 @@ return T.type(e).create(null, r);

return;
const o = g.get(n.node);
const o = h.get(n.node);
if (!(e < 0 || e >= o.width))

@@ -98,3 +98,3 @@ return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {

return;
const o = g.get(n.node);
const o = h.get(n.node);
if (!(e < 0 || e >= o.height))

@@ -116,3 +116,3 @@ return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {

return;
const n = g.get(t.node);
const n = h.get(t.node);
return n.cellsInRect({

@@ -133,3 +133,3 @@ left: 0,

const l = e.doc.resolve(o.pos);
return M(e.setSelection(new y(l, n)));
return A(e.setSelection(new y(l, n)));
}

@@ -139,3 +139,3 @@ }

};
function ae(e, t, { map: n, tableStart: o, table: l }, r) {
function se(e, t, { map: n, tableStart: o, table: l }, r) {
const s = Array(r).fill(0).reduce((i, m, a) => i + l.child(a).nodeSize, o), c = Array(n.width).fill(0).map((i, m) => {

@@ -147,6 +147,6 @@ const a = l.nodeAt(n.map[m]);

}
const se = (e) => (t) => (n) => {
const ce = (e) => (t) => (n) => {
const o = w(n.selection), l = e === "row";
if (o) {
const r = g.get(o.node);
const r = h.get(o.node);
if (t >= 0 && t < (l ? r.height : r.width)) {

@@ -158,8 +158,8 @@ const s = r.positionAt(

), c = n.doc.resolve(o.start + s), i = l ? y.rowSelection : y.colSelection, m = r.positionAt(l ? t : 0, l ? 0 : t, o.node), a = n.doc.resolve(o.start + m);
return M(n.setSelection(i(c, a)));
return A(n.setSelection(i(c, a)));
}
}
return n;
}, Je = se("row"), Qe = se("col"), U = (e) => e[0].map((t, n) => e.map((o) => o[n])), ce = (e, t) => {
const n = [], o = g.get(e);
}, Je = ce("row"), Qe = ce("col"), X = (e) => e[0].map((t, n) => e.map((o) => o[n])), ie = (e, t) => {
const n = [], o = h.get(e);
for (let r = 0; r < o.height; r++) {

@@ -184,4 +184,4 @@ const s = e.child(r), c = [];

);
}, ie = (e) => {
const t = g.get(e), n = [];
}, de = (e) => {
const t = h.get(e), n = [];
for (let o = 0; o < t.height; o++) {

@@ -200,3 +200,3 @@ const l = [], r = {};

return n;
}, de = (e, t, n, o) => {
}, me = (e, t, n, o) => {
const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;

@@ -206,8 +206,8 @@ let c;

}, Ye = (e, t, n, o) => {
let l = U(ie(e.node));
return l = de(l, t, n, o), l = U(l), ce(e.node, l);
let l = X(de(e.node));
return l = me(l, t, n, o), l = X(l), ie(e.node, l);
}, et = (e, t, n, o) => {
let l = ie(e.node);
return l = de(l, t, n, o), ce(e.node, l);
}, X = (e, t) => {
let l = de(e.node);
return l = me(l, t, n, o), ie(e.node, l);
}, q = (e, t) => {
let n = e, o = e;

@@ -252,3 +252,3 @@ for (let a = e; a >= 0; a--) {

return { $anchor: c, $head: m, indexes: l };
}, q = (e, t) => {
}, J = (e, t) => {
let n = e, o = e;

@@ -292,3 +292,3 @@ for (let a = e; a >= 0; a--)

return e;
const { indexes: r } = X(t, e), { indexes: s } = X(n, e);
const { indexes: r } = q(t, e), { indexes: s } = q(n, e);
if (r.includes(n))

@@ -301,3 +301,3 @@ return e;

0
), i = M(e).replaceWith(
), i = A(e).replaceWith(
l.pos,

@@ -309,4 +309,4 @@ l.pos + l.node.nodeSize,

return i;
const m = g.get(c), a = l.start, u = n, p = m.positionAt(m.height - 1, u, c), f = i.doc.resolve(a + p), $ = y.colSelection, _ = m.positionAt(0, u, c), P = i.doc.resolve(a + _);
return i.setSelection($(f, P));
const m = h.get(c), a = l.start, u = n, p = m.positionAt(m.height - 1, u, c), f = i.doc.resolve(a + p), $ = y.colSelection, P = m.positionAt(0, u, c), _ = i.doc.resolve(a + P);
return i.setSelection($(f, _));
}

@@ -317,3 +317,3 @@ function ot(e, t, n, o = !0) {

return e;
const { indexes: r } = q(t, e), { indexes: s } = q(n, e);
const { indexes: r } = J(t, e), { indexes: s } = J(n, e);
if (r.includes(n))

@@ -326,3 +326,3 @@ return e;

0
), i = M(e).replaceWith(
), i = A(e).replaceWith(
l.pos,

@@ -334,4 +334,4 @@ l.pos + l.node.nodeSize,

return i;
const m = g.get(c), a = l.start, u = n, p = m.positionAt(u, m.width - 1, c), f = i.doc.resolve(a + p), $ = y.rowSelection, _ = m.positionAt(u, 0, c), P = i.doc.resolve(a + _);
return i.setSelection($(f, P));
const m = h.get(c), a = l.start, u = n, p = m.positionAt(u, m.width - 1, c), f = i.doc.resolve(a + p), $ = y.rowSelection, P = m.positionAt(u, 0, c), _ = i.doc.resolve(a + P);
return i.setSelection($(f, _));
}

@@ -461,3 +461,3 @@ const v = Be({

});
const me = te((e) => new Y(
const ue = oe((e) => new ee(
/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,

@@ -469,3 +469,3 @@ (t, n, o, l) => {

return null;
const s = re(
const s = ae(
e,

@@ -478,12 +478,12 @@ Number((i = n.groups) == null ? void 0 : i.row),

));
d(me, {
d(ue, {
displayName: "InputRule<insertTableInputRule>",
group: "Table"
});
const F = h("GoToPrevTableCell", () => () => ne(-1));
d(F, {
const L = g("GoToPrevTableCell", () => () => le(-1));
d(L, {
displayName: "Command<goToPrevTableCellCommand>",
group: "Table"
});
const W = h("GoToNextTableCell", () => () => ne(1));
const W = g("GoToNextTableCell", () => () => le(1));
d(W, {

@@ -493,37 +493,37 @@ displayName: "Command<goToNextTableCellCommand>",

});
const z = h("BreakTable", (e) => () => (t, n) => {
const G = g("BreakTable", (e) => () => (t, n) => {
if (!N(t))
return !1;
const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, Q.type(e).createAndFill());
return r.setSelection(oe.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, Y.type(e).createAndFill());
return r.setSelection(ne.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
});
d(z, {
d(G, {
displayName: "Command<breakTableCommand>",
group: "Table"
});
const ue = h("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
const { selection: r, tr: s } = o, { from: c } = r, i = re(e, t, n), m = s.replaceSelectionWith(i), a = oe.findFrom(m.doc.resolve(c), 1, !0);
const pe = g("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
const { selection: r, tr: s } = o, { from: c } = r, i = ae(e, t, n), m = s.replaceSelectionWith(i), a = ne.findFrom(m.doc.resolve(c), 1, !0);
return a && m.setSelection(a), l == null || l(m), !0;
});
d(ue, {
d(pe, {
displayName: "Command<insertTableCommand>",
group: "Table"
});
const pe = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
const fe = g("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
const { tr: l } = n;
return !!(o == null ? void 0 : o(ot(l, e ?? 0, t ?? 0, !0)));
});
d(pe, {
d(fe, {
displayName: "Command<moveRowCommand>",
group: "Table"
});
const fe = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
const ge = g("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
const { tr: l } = n;
return !!(o == null ? void 0 : o(tt(l, e ?? 0, t ?? 0, !0)));
});
d(fe, {
d(ge, {
displayName: "Command<moveColCommand>",
group: "Table"
});
const he = h("SelectRow", () => (e = 0) => (t, n) => {
const he = g("SelectRow", () => (e = 0) => (t, n) => {
const { tr: o } = t;

@@ -536,19 +536,19 @@ return !!(n == null ? void 0 : n(Je(e)(o)));

});
const ge = h("SelectCol", () => (e = 0) => (t, n) => {
const be = g("SelectCol", () => (e = 0) => (t, n) => {
const { tr: o } = t;
return !!(n == null ? void 0 : n(Qe(e)(o)));
});
d(ge, {
d(be, {
displayName: "Command<selectColCommand>",
group: "Table"
});
const be = h("SelectTable", () => () => (e, t) => {
const Ce = g("SelectTable", () => () => (e, t) => {
const { tr: n } = e;
return !!(t == null ? void 0 : t(qe(n)));
});
d(be, {
d(Ce, {
displayName: "Command<selectTableCommand>",
group: "Table"
});
const Ce = h("DeleteSelectedCells", () => () => (e, t) => {
const ye = g("DeleteSelectedCells", () => () => (e, t) => {
const { selection: n } = e;

@@ -558,54 +558,54 @@ if (!(n instanceof y))

const o = n.isRowSelection(), l = n.isColSelection();
return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
return o && l ? Fe(e, t) : l ? Ke(e, t) : He(e, t);
});
d(Ce, {
d(ye, {
displayName: "Command<deleteSelectedCellsCommand>",
group: "Table"
});
const ye = h("AddColBefore", () => () => Fe);
d(ye, {
const ke = g("AddColBefore", () => () => Le);
d(ke, {
displayName: "Command<addColBeforeCommand>",
group: "Table"
});
const ke = h("AddColAfter", () => () => We);
d(ke, {
const we = g("AddColAfter", () => () => We);
d(we, {
displayName: "Command<addColAfterCommand>",
group: "Table"
});
const we = h("AddRowBefore", (e) => () => (t, n) => {
const Ne = g("AddRowBefore", (e) => () => (t, n) => {
if (!N(t))
return !1;
if (n) {
const o = le(t);
n(ae(e, t.tr, o, o.top));
const o = re(t);
n(se(e, t.tr, o, o.top));
}
return !0;
});
d(we, {
d(Ne, {
displayName: "Command<addRowBeforeCommand>",
group: "Table"
});
const Ne = h("AddRowAfter", (e) => () => (t, n) => {
const Te = g("AddRowAfter", (e) => () => (t, n) => {
if (!N(t))
return !1;
if (n) {
const o = le(t);
n(ae(e, t.tr, o, o.bottom));
const o = re(t);
n(se(e, t.tr, o, o.bottom));
}
return !0;
});
d(Ne, {
d(Te, {
displayName: "Command<addRowAfterCommand>",
group: "Table"
});
const Te = h("SetAlign", () => (e = "left") => ze("alignment", e));
d(Te, {
const Se = g("SetAlign", () => (e = "left") => Ge("alignment", e));
d(Se, {
displayName: "Command<setAlignCommand>",
group: "Table"
});
const G = ee("tableKeymap", {
const z = te("tableKeymap", {
NextCell: {
shortcuts: ["Mod-]", "Tab"],
command: (e) => {
const t = e.get(A);
const t = e.get(M);
return () => t.call(W.key);

@@ -617,4 +617,4 @@ }

command: (e) => {
const t = e.get(A);
return () => t.call(F.key);
const t = e.get(M);
return () => t.call(L.key);
}

@@ -625,16 +625,16 @@ },

command: (e) => {
const t = e.get(A);
return () => t.call(z.key);
const t = e.get(M);
return () => t.call(G.key);
}
}
});
d(G.ctx, {
d(z.ctx, {
displayName: "KeymapCtx<table>",
group: "Table"
});
d(G.shortcuts, {
d(z.shortcuts, {
displayName: "Keymap<table>",
group: "Table"
});
const E = "footnote_definition", J = "footnoteDefinition", j = k("footnote_definition", () => ({
const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_definition", () => ({
group: "block",

@@ -675,3 +675,3 @@ content: "block+",

parseMarkdown: {
match: ({ type: e }) => e === J,
match: ({ type: e }) => e === Q,
runner: (e, t, n) => {

@@ -686,3 +686,3 @@ e.openNode(n, {

runner: (e, t) => {
e.openNode(J, void 0, {
e.openNode(Q, void 0, {
label: t.attrs.label,

@@ -761,3 +761,3 @@ identifier: t.attrs.label

});
const Se = Ie.extendSchema((e) => (t) => {
const Re = Ie.extendSchema((e) => (t) => {
const n = e(t);

@@ -823,7 +823,7 @@ return {

});
d(Se, {
d(Re, {
displayName: "NodeSchema<listItem>",
group: "ListItem"
});
const Re = te(() => new Y(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
const Me = oe(() => new ee(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
var a;

@@ -839,3 +839,3 @@ const l = e.doc.resolve(n);

}));
d(Re, {
d(Me, {
displayName: "InputRule<wrapInTaskListInputRule>",

@@ -845,9 +845,9 @@ group: "ListItem"

const nt = [
L,
G
H,
z
].flat(), lt = [
me,
Re
ue,
Me
], Ae = B((e) => {
const t = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n = (l) => l.type === Q.type(e), o = (l) => n(l) && l.nodeSize === 2;
const t = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n = (l) => l.type === Y.type(e), o = (l) => n(l) && l.nodeSize === 2;
return new Oe({

@@ -859,7 +859,7 @@ key: t,

const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
return V.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("⁠", m.start())), !1;
return U.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("⁠", m.start())), !1;
},
compositionend(l) {
const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
return V.safari && N(r) && i.empty && n(m.parent) && m.parent.textContent.startsWith("⁠") && s(c.delete(m.start(), m.start() + 1)), !1;
return U.safari && N(r) && i.empty && n(m.parent) && m.parent.textContent.startsWith("⁠") && s(c.delete(m.start(), m.start() + 1)), !1;
}

@@ -874,24 +874,28 @@ }

});
const Me = B(() => Ge({}));
d(Me, {
const xe = B(() => ze({}));
d(xe, {
displayName: "Prose<columnResizingPlugin>",
group: "Prose"
});
const xe = B(() => je());
d(xe, {
const ve = B(() => je());
d(ve, {
displayName: "Prose<tableEditingPlugin>",
group: "Prose"
});
const ve = Pe(() => Ue);
d(ve, {
const V = _e("remarkGFM", () => Ue);
d(V.plugin, {
displayName: "Remark<remarkGFMPlugin>",
group: "Remark"
});
d(V.options, {
displayName: "RemarkConfig<remarkGFMPlugin>",
group: "Remark"
});
const rt = [
Ae,
Me,
xe,
ve
], at = [
Se,
ve,
V
].flat(), at = [
Re,
T,

@@ -903,33 +907,35 @@ S,

Z,
K,
F,
x
].flat(), st = [
W,
F,
z,
ue,
L,
G,
pe,
fe,
ge,
he,
ge,
be,
Ce,
we,
ye,
Ne,
ye,
Te,
ke,
Te,
H
we,
Se,
K
], Ct = [at, lt, nt, rt, st].flat();
export {
ke as addColAfterCommand,
ye as addColBeforeCommand,
Ne as addRowAfterCommand,
we as addRowBeforeCommand,
ae as addRowWithAlignment,
z as breakTableCommand,
we as addColAfterCommand,
ke as addColBeforeCommand,
Te as addRowAfterCommand,
Ne as addRowBeforeCommand,
se as addRowWithAlignment,
Ae as autoInsertZeroSpaceInTablePlugin,
G as breakTableCommand,
xe as columnResizingPlugin,
st as commands,
re as createTable,
Ce as deleteSelectedCellsCommand,
Se as extendListItemSchemaForTask,
ae as createTable,
ye as deleteSelectedCellsCommand,
Re as extendListItemSchemaForTask,
w as findTable,

@@ -943,32 +949,34 @@ j as footnoteDefinitionSchema,

W as goToNextTableCellCommand,
F as goToPrevTableCellCommand,
L as goToPrevTableCellCommand,
lt as inputrules,
ue as insertTableCommand,
me as insertTableInputRule,
pe as insertTableCommand,
ue as insertTableInputRule,
nt as keymap,
tt as moveCol,
fe as moveColCommand,
ge as moveColCommand,
ot as moveRow,
pe as moveRowCommand,
fe as moveRowCommand,
rt as plugins,
V as remarkGFMPlugin,
at as schema,
Qe as selectCol,
ge as selectColCommand,
se as selectLine,
be as selectColCommand,
ce as selectLine,
Je as selectRow,
he as selectRowCommand,
qe as selectTable,
be as selectTableCommand,
Te as setAlignCommand,
K as strikethroughAttr,
L as strikethroughKeymap,
Ce as selectTableCommand,
Se as setAlignCommand,
F as strikethroughAttr,
H as strikethroughKeymap,
x as strikethroughSchema,
R as tableCellSchema,
ve as tableEditingPlugin,
I as tableHeaderSchema,
G as tableKeymap,
z as tableKeymap,
S as tableRowSchema,
T as tableSchema,
H as toggleStrikethroughCommand,
Re as wrapInTaskListInputRule
K as toggleStrikethroughCommand,
Me as wrapInTaskListInputRule
};
//# sourceMappingURL=index.es.js.map

@@ -1,2 +0,2 @@

export declare const remarkGFMPlugin: import("@milkdown/utils").$Remark;
export declare const remarkGFMPlugin: import("@milkdown/utils").$Remark<"remarkGFM", void | import("remark-gfm").Options | undefined>;
//# sourceMappingURL=remark-gfm-plugin.d.ts.map
{
"name": "@milkdown/preset-gfm",
"type": "module",
"version": "7.2.4",
"version": "7.3.0",
"license": "MIT",

@@ -34,11 +34,11 @@ "repository": {

"tslib": "^2.5.0",
"@milkdown/exception": "7.2.4",
"@milkdown/utils": "7.2.4"
"@milkdown/exception": "7.3.0",
"@milkdown/utils": "7.3.0"
},
"devDependencies": {
"@milkdown/core": "7.2.4",
"@milkdown/ctx": "7.2.4",
"@milkdown/preset-commonmark": "7.2.4",
"@milkdown/prose": "7.2.4",
"@milkdown/transformer": "7.2.4"
"@milkdown/core": "7.3.0",
"@milkdown/ctx": "7.3.0",
"@milkdown/preset-commonmark": "7.3.0",
"@milkdown/prose": "7.3.0",
"@milkdown/transformer": "7.3.0"
},

@@ -45,0 +45,0 @@ "nx": {

/* Copyright 2021, Milkdown by Mirone. */
import type { MilkdownPlugin } from '@milkdown/ctx'
import { autoInsertZeroSpaceInTablePlugin, columnResizingPlugin, remarkGFMPlugin, tableEditingPlugin } from '../plugin'
import {
autoInsertZeroSpaceInTablePlugin,
columnResizingPlugin,
remarkGFMPlugin,
tableEditingPlugin,
} from '../plugin'

@@ -11,2 +16,2 @@ /// @internal

remarkGFMPlugin,
]
].flat()

@@ -7,2 +7,3 @@ /* Copyright 2021, Milkdown by Mirone. */

export * from './mark'
export * from './plugin'
export * from './composed'

@@ -9,0 +10,0 @@

@@ -7,7 +7,12 @@ /* Copyright 2021, Milkdown by Mirone. */

/// This plugin is wrapping the [remark-gfm](https://github.com/remarkjs/remark-gfm).
export const remarkGFMPlugin = $remark(() => remarkGFM)
export const remarkGFMPlugin = $remark('remarkGFM', () => remarkGFM)
withMeta(remarkGFMPlugin, {
withMeta(remarkGFMPlugin.plugin, {
displayName: 'Remark<remarkGFMPlugin>',
group: 'Remark',
})
withMeta(remarkGFMPlugin.options, {
displayName: 'RemarkConfig<remarkGFMPlugin>',
group: 'Remark',
})

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc