Comparing version 0.23.0 to 0.24.0
@@ -1,11 +0,11 @@ | ||
import { getNextElement as f, getNextMarker as k, insert as m, createComponent as l, effect as ne, setAttribute as pe, runHydrationEvents as le, delegateEvents as ke, template as g, use as he, memo as De, spread as Te, mergeProps as Ve, hydrate as Oe, render as Re } from "solid-js/web"; | ||
import { createSignal as R, onMount as be, onCleanup as qe, For as Ie, Show as b, createEffect as Ne, createContext as Pe, useContext as We } from "solid-js"; | ||
import { Compartment as xe, SelectionRange as Fe, EditorSelection as Ue, RangeSetBuilder as ve, Transaction as Xe, EditorState as Ke } from "@codemirror/state"; | ||
import { markdown as Qe, markdownLanguage as Ye } from "@codemirror/lang-markdown"; | ||
import { languages as Ze } from "@codemirror/language-data"; | ||
import { EditorView as Q, Decoration as V, ViewPlugin as ye, keymap as Ge } from "@codemirror/view"; | ||
import { syntaxTree as se, syntaxHighlighting as Je, HighlightStyle as et } from "@codemirror/language"; | ||
import { defaultKeymap as tt, historyKeymap as nt, indentMore as ot, indentLess as rt, history as it } from "@codemirror/commands"; | ||
import { getNextElement as f, getNextMarker as k, insert as m, createComponent as l, effect as ne, setAttribute as pe, runHydrationEvents as le, delegateEvents as ke, template as p, use as he, memo as Te, spread as Ve, mergeProps as Oe, hydrate as Re, render as qe } from "solid-js/web"; | ||
import { createSignal as R, onMount as be, onCleanup as Ie, For as Ne, Show as b, createEffect as Pe, createContext as We, useContext as Fe } from "solid-js"; | ||
import { Compartment as xe, SelectionRange as Ue, EditorSelection as Xe, RangeSetBuilder as ve, Transaction as Ke, EditorState as Qe } from "@codemirror/state"; | ||
import { markdown as Ye, markdownLanguage as Ze } from "@codemirror/lang-markdown"; | ||
import { languages as Ge } from "@codemirror/language-data"; | ||
import { EditorView as Q, Decoration as V, ViewPlugin as ye, keymap as Je } from "@codemirror/view"; | ||
import { syntaxTree as se, syntaxHighlighting as et, HighlightStyle as tt } from "@codemirror/language"; | ||
import { defaultKeymap as nt, historyKeymap as ot, indentMore as rt, indentLess as it, history as at } from "@codemirror/commands"; | ||
import { tags as d } from "@lezer/highlight"; | ||
const at = "data-ink-mde-ssr-hydration-marker", lt = `[${at}]`, st = () => ({}), O = { | ||
const lt = "data-ink-mde-ssr-hydration-marker", st = `[${lt}]`, ct = () => ({}), O = { | ||
array: "[object Array]", | ||
@@ -16,11 +16,11 @@ object: "[object Object]", | ||
window: "[object Window]" | ||
}, ct = (e) => { | ||
}, dt = (e) => { | ||
if (Object.prototype.toString.call(e) === O.object) | ||
return `[object ${e.constructor.name}]`; | ||
}, P = (e, t) => ct(e) === t, dt = (e, t) => { | ||
}, P = (e, t) => dt(e) === t, ut = (e, t) => { | ||
const n = /* @__PURE__ */ new WeakMap(), o = (r, i) => n.get(r) || (P(r, O.object) && n.set(r, !0), P(i, O.undefined)) ? r : P(r, O.array) && P(i, O.array) ? [...i] : P(r, O.object) && P(i, O.object) ? Object.keys(r).reduce((a, s) => (Object.hasOwnProperty.call(i, s) ? a[s] = o(r[s], i[s]) : a[s] = r[s], a), {}) : i; | ||
return o(e, t); | ||
}, Y = (e, t) => dt(e, t); | ||
var W = /* @__PURE__ */ ((e) => (e.Auto = "auto", e.Dark = "dark", e.Light = "light", e))(W || {}), ut = /* @__PURE__ */ ((e) => (e.Appearance = "appearance", e.Attribution = "attribution", e.Autocomplete = "autocomplete", e.Images = "images", e.ReadOnly = "readonly", e.Spellcheck = "spellcheck", e.Vim = "vim", e))(ut || {}), x = /* @__PURE__ */ ((e) => (e.Bold = "bold", e.Code = "code", e.CodeBlock = "code_block", e.Heading = "heading", e.Image = "image", e.Italic = "italic", e.Link = "link", e.List = "list", e.OrderedList = "ordered_list", e.Quote = "quote", e.TaskList = "task_list", e))(x || {}), J = /* @__PURE__ */ ((e) => (e.Completion = "completion", e.Default = "default", e.Grammar = "grammar", e.Language = "language", e))(J || {}), oe = /* @__PURE__ */ ((e) => (e.End = "end", e.Start = "start", e))(oe || {}); | ||
const ge = () => document.createElement("div"), $e = () => window.matchMedia("(prefers-color-scheme: dark)").matches, ft = (e) => e === W.Dark ? !0 : e === W.Light ? !1 : $e(), te = (e) => { | ||
}, Y = (e, t) => ut(e, t); | ||
var W = /* @__PURE__ */ ((e) => (e.Auto = "auto", e.Dark = "dark", e.Light = "light", e))(W || {}), ft = /* @__PURE__ */ ((e) => (e.Appearance = "appearance", e.Attribution = "attribution", e.Autocomplete = "autocomplete", e.Images = "images", e.ReadOnly = "readonly", e.Spellcheck = "spellcheck", e.Vim = "vim", e))(ft || {}), x = /* @__PURE__ */ ((e) => (e.Bold = "bold", e.Code = "code", e.CodeBlock = "code_block", e.Heading = "heading", e.Image = "image", e.Italic = "italic", e.Link = "link", e.List = "list", e.OrderedList = "ordered_list", e.Quote = "quote", e.TaskList = "task_list", e))(x || {}), J = /* @__PURE__ */ ((e) => (e.Completion = "completion", e.Default = "default", e.Grammar = "grammar", e.Language = "language", e))(J || {}), oe = /* @__PURE__ */ ((e) => (e.End = "end", e.Start = "start", e))(oe || {}); | ||
const ge = () => document.createElement("div"), $e = () => window.matchMedia("(prefers-color-scheme: dark)").matches, mt = (e) => e === W.Dark ? !0 : e === W.Light ? !1 : $e(), te = (e) => { | ||
const t = [ | ||
@@ -103,3 +103,3 @@ // --ink-* | ||
{ suffix: "toolbar-item-spacing", default: "0" } | ||
], n = !ft(e.options.interface.appearance); | ||
], n = !mt(e.options.interface.appearance); | ||
return t.map((o) => { | ||
@@ -109,7 +109,7 @@ const r = n && o.light ? o.light : o.default; | ||
}); | ||
}, mt = (e) => [ | ||
}, pt = (e) => [ | ||
Q.theme({}, { dark: e }) | ||
], pt = (e) => e.extensions.map((t) => t.initialValue(e)), ce = (e) => Promise.all( | ||
], gt = (e) => e.extensions.map((t) => t.initialValue(e)), ce = (e) => Promise.all( | ||
e.extensions.map((t) => t.reconfigure(e.options)) | ||
), gt = (e) => { | ||
), kt = (e) => { | ||
const t = new xe(); | ||
@@ -121,3 +121,3 @@ return { | ||
}; | ||
}, kt = (e) => { | ||
}, ht = (e) => { | ||
const t = new xe(); | ||
@@ -129,12 +129,12 @@ return { | ||
}; | ||
}, ht = () => [ | ||
...bt.map((e) => gt(e)), | ||
...xt.map((e) => kt(e)) | ||
], bt = [ | ||
}, bt = () => [ | ||
...xt.map((e) => kt(e)), | ||
...vt.map((e) => ht(e)) | ||
], xt = [ | ||
(e) => e.plugins.reduce((n, o) => (o.type === J.Default && n.push(o.value), n), []), | ||
(e) => { | ||
const t = e.plugins.reduce((o, r) => (r.type === J.Grammar && o.push(r.value), o), []), n = e.plugins.reduce((o, r) => (r.type === J.Language && o.push(r.value), o), []); | ||
return Qe({ | ||
base: Ye, | ||
codeLanguages: [...Ze, ...n], | ||
return Ye({ | ||
base: Ze, | ||
codeLanguages: [...Ge, ...n], | ||
extensions: t | ||
@@ -145,5 +145,5 @@ }); | ||
const t = e.interface.appearance === W.Dark, n = e.interface.appearance === W.Auto; | ||
return mt(t || n && $e()); | ||
return pt(t || n && $e()); | ||
} | ||
], xt = [ | ||
], vt = [ | ||
async (e, t) => { | ||
@@ -185,2 +185,9 @@ if (e.interface.autocomplete) { | ||
async (e, t) => { | ||
if (e.search) { | ||
const { search: n } = await import("./search-72d4d407.js"); | ||
return t.reconfigure(n()); | ||
} | ||
return t.reconfigure([]); | ||
}, | ||
async (e, t) => { | ||
if (e.interface.spellcheck) { | ||
@@ -229,2 +236,3 @@ const { spellcheck: n } = await import("./spellcheck-9deeebb9.js"); | ||
readability: !1, | ||
search: !0, | ||
selections: [], | ||
@@ -250,3 +258,3 @@ toolbar: { | ||
editor: {}, | ||
extensions: ht(), | ||
extensions: bt(), | ||
options: e, | ||
@@ -256,6 +264,6 @@ root: ge(), | ||
}; | ||
}, vt = (e) => Y(re(), e), de = (e, t = {}) => { | ||
const [n, o] = R(vt({ ...t, doc: e.doc || "", options: e })); | ||
}, yt = (e) => Y(re(), e), de = (e, t = {}) => { | ||
const [n, o] = R(yt({ ...t, doc: e.doc || "", options: e })); | ||
return [n, o]; | ||
}, yt = ([e]) => { | ||
}, $t = ([e]) => { | ||
const { editor: t } = e(); | ||
@@ -267,4 +275,4 @@ t.destroy(); | ||
}, _e = (e) => { | ||
const t = e.map((n) => Fe.fromJSON({ anchor: n.start, head: n.end })); | ||
return Ue.create(t); | ||
const t = e.map((n) => Ue.fromJSON({ anchor: n.start, head: n.end })); | ||
return Xe.create(t); | ||
}, we = (e) => e.ranges.map((n) => ({ | ||
@@ -281,3 +289,3 @@ end: n.anchor < n.head ? n.head : n.anchor, | ||
suffix: "" | ||
}, ...e }), $t = { | ||
}, ...e }), _t = { | ||
[x.Bold]: A({ | ||
@@ -344,3 +352,3 @@ nodes: ["StrongEmphasis"], | ||
}) | ||
}, _t = ({ editor: e, selection: t }) => { | ||
}, wt = ({ editor: e, selection: t }) => { | ||
let n = t.start; | ||
@@ -353,3 +361,3 @@ const o = []; | ||
return o; | ||
}, wt = ({ editor: e, formatDefinition: t, selection: n }) => { | ||
}, Ct = ({ editor: e, formatDefinition: t, selection: n }) => { | ||
if (!e || !t) | ||
@@ -364,3 +372,3 @@ return n || { start: 0, end: 0 }; | ||
return { start: r, end: i }; | ||
}, Ce = (e) => e.editor.state.sliceDoc(e.selection.start, e.selection.end), Ct = (e, t, n) => St(e, n).find(({ type: r }) => t.nodes.includes(r.name)), St = (e, t) => { | ||
}, Ce = (e) => e.editor.state.sliceDoc(e.selection.start, e.selection.end), St = (e, t, n) => Lt(e, n).find(({ type: r }) => t.nodes.includes(r.name)), Lt = (e, t) => { | ||
const n = []; | ||
@@ -377,3 +385,3 @@ return se(e.state).iterate({ | ||
return [{ from: e.selection.start, to: e.selection.end, insert: r }]; | ||
}, Lt = (e) => { | ||
}, Mt = (e) => { | ||
if (e.node) { | ||
@@ -389,4 +397,4 @@ const t = e.node.from, n = e.node.to; | ||
} | ||
}, Mt = (e) => { | ||
const t = _t(e), n = []; | ||
}, Ht = (e) => { | ||
const t = wt(e), n = []; | ||
return t.forEach((o) => { | ||
@@ -407,3 +415,3 @@ const r = Se({ ...e, selection: o }); | ||
return [{ from: e.selection.start, insert: e.formatDefinition.prefix }]; | ||
}, Ht = (e) => { | ||
}, At = (e) => { | ||
if (e.node) { | ||
@@ -419,4 +427,4 @@ const t = e.node.from, n = e.node.to; | ||
} | ||
}, At = (e) => e.formatDefinition.block ? Lt(e) : e.formatDefinition.multiline ? Mt(e) : e.formatDefinition.line ? Se(e) : Ht(e), Le = ([e], t, { selection: n } = {}) => { | ||
const { editor: o } = e(), r = $t[t], i = wt({ editor: o, formatDefinition: r, selection: n }), a = Ct(o, r, i), c = At({ | ||
}, zt = (e) => e.formatDefinition.block ? Mt(e) : e.formatDefinition.multiline ? Ht(e) : e.formatDefinition.line ? Se(e) : At(e), Le = ([e], t, { selection: n } = {}) => { | ||
const { editor: o } = e(), r = _t[t], i = Ct({ editor: o, formatDefinition: r, selection: n }), a = St(o, r, i), c = zt({ | ||
editor: o, | ||
@@ -431,3 +439,3 @@ formatDefinition: r, | ||
e().editor.dispatch(v); | ||
}, zt = ([e]) => { | ||
}, Et = ([e]) => { | ||
const { editor: t } = e(); | ||
@@ -455,5 +463,5 @@ return t.state.sliceDoc(); | ||
"Blockquote" | ||
], Et = V.line({ attributes: { class: "cm-blockquote" } }), jt = V.line({ attributes: { class: "cm-blockquote-open" } }), Dt = V.line({ attributes: { class: "cm-blockquote-close" } }), Tt = ye.define((e) => ({ | ||
update: () => Vt(e) | ||
}), { decorations: (e) => e.update() }), Vt = (e) => { | ||
], jt = V.line({ attributes: { class: "cm-blockquote" } }), Dt = V.line({ attributes: { class: "cm-blockquote-open" } }), Tt = V.line({ attributes: { class: "cm-blockquote-close" } }), Vt = ye.define((e) => ({ | ||
update: () => Ot(e) | ||
}), { decorations: (e) => e.update() }), Ot = (e) => { | ||
const t = new ve(), n = se(e.state); | ||
@@ -466,5 +474,5 @@ for (const o of e.visibleRanges) | ||
if (a.name !== "Document" && Bt.includes(a.name)) { | ||
t.add(i.from, i.from, Et); | ||
t.add(i.from, i.from, jt); | ||
const u = e.state.doc.lineAt(s), v = e.state.doc.lineAt(c); | ||
return u.number === i.number && t.add(i.from, i.from, jt), v.number === i.number && t.add(i.from, i.from, Dt), !1; | ||
return u.number === i.number && t.add(i.from, i.from, Dt), v.number === i.number && t.add(i.from, i.from, Tt), !1; | ||
} | ||
@@ -477,5 +485,5 @@ }, | ||
return t.finish(); | ||
}, Ot = () => [ | ||
Tt | ||
], Rt = [ | ||
}, Rt = () => [ | ||
Vt | ||
], qt = [ | ||
"CodeBlock", | ||
@@ -491,5 +499,5 @@ "FencedCode", | ||
spellcheck: "false" | ||
}, qt = V.line({ attributes: { ...F, class: "cm-codeblock" } }), It = V.line({ attributes: { ...F, class: "cm-codeblock-open" } }), Nt = V.line({ attributes: { ...F, class: "cm-codeblock-close" } }), Pt = V.mark({ attributes: { ...F, class: "cm-code" } }), Wt = V.mark({ attributes: { ...F, class: "cm-code cm-code-open" } }), Ft = V.mark({ attributes: { ...F, class: "cm-code cm-code-close" } }), Ut = ye.define((e) => ({ | ||
update: () => Xt(e) | ||
}), { decorations: (e) => e.update() }), Xt = (e) => { | ||
}, It = V.line({ attributes: { ...F, class: "cm-codeblock" } }), Nt = V.line({ attributes: { ...F, class: "cm-codeblock-open" } }), Pt = V.line({ attributes: { ...F, class: "cm-codeblock-close" } }), Wt = V.mark({ attributes: { ...F, class: "cm-code" } }), Ft = V.mark({ attributes: { ...F, class: "cm-code cm-code-open" } }), Ut = V.mark({ attributes: { ...F, class: "cm-code cm-code-close" } }), Xt = ye.define((e) => ({ | ||
update: () => Kt(e) | ||
}), { decorations: (e) => e.update() }), Kt = (e) => { | ||
const t = new ve(), n = se(e.state); | ||
@@ -503,8 +511,8 @@ for (const o of e.visibleRanges) | ||
if (s.name !== "Document") | ||
if (Rt.includes(s.name)) { | ||
t.add(i.from, i.from, qt); | ||
if (qt.includes(s.name)) { | ||
t.add(i.from, i.from, It); | ||
const v = e.state.doc.lineAt(c), _ = e.state.doc.lineAt(u); | ||
return v.number === i.number && t.add(i.from, i.from, It), _.number === i.number && t.add(i.from, i.from, Nt), !1; | ||
return v.number === i.number && t.add(i.from, i.from, Nt), _.number === i.number && t.add(i.from, i.from, Pt), !1; | ||
} else | ||
s.name === "InlineCode" ? a = { from: c, to: u, innerFrom: c, innerTo: u } : s.name === "CodeMark" && (c === a.from ? (a.innerFrom = u, t.add(c, u, Wt)) : u === a.to && (a.innerTo = c, t.add(a.innerFrom, a.innerTo, Pt), t.add(c, u, Ft))); | ||
s.name === "InlineCode" ? a = { from: c, to: u, innerFrom: c, innerTo: u } : s.name === "CodeMark" && (c === a.from ? (a.innerFrom = u, t.add(c, u, Ft)) : u === a.to && (a.innerTo = c, t.add(a.innerFrom, a.innerTo, Wt), t.add(c, u, Ut))); | ||
}, | ||
@@ -516,5 +524,5 @@ from: i.from, | ||
return t.finish(); | ||
}, Kt = () => [ | ||
Ut | ||
], Qt = () => [ | ||
}, Qt = () => [ | ||
Xt | ||
], Yt = () => [ | ||
Q.editorAttributes.of({ | ||
@@ -527,22 +535,22 @@ class: "ink-mde-container" | ||
// Todo: Maybe open a PR to add scrollerAttributes? | ||
], Yt = () => [ | ||
...Qt() | ||
], Zt = [ | ||
], Zt = () => [ | ||
...Yt() | ||
], Gt = [ | ||
{ | ||
key: "Tab", | ||
run: ({ state: e, dispatch: t }) => e.selection.ranges.some((n) => !n.empty) ? ot({ state: e, dispatch: t }) : (t( | ||
run: ({ state: e, dispatch: t }) => e.selection.ranges.some((n) => !n.empty) ? rt({ state: e, dispatch: t }) : (t( | ||
e.update(e.replaceSelection(" "), { | ||
scrollIntoView: !0, | ||
annotations: Xe.userEvent.of("input") | ||
annotations: Ke.userEvent.of("input") | ||
}) | ||
), !0), | ||
shift: rt | ||
shift: it | ||
} | ||
], Gt = () => Ge.of([ | ||
...Zt, | ||
...tt, | ||
...nt | ||
]), Jt = () => Q.lineWrapping, en = () => [ | ||
Je( | ||
et.define([ | ||
], Jt = () => Je.of([ | ||
...Gt, | ||
...nt, | ||
...ot | ||
]), en = () => Q.lineWrapping, tn = () => [ | ||
et( | ||
tt.define([ | ||
// ordered by lowest to highest precedence | ||
@@ -701,21 +709,21 @@ { | ||
) | ||
], tn = (e) => { | ||
], nn = (e) => { | ||
if (e.length > 0) | ||
return _e(e); | ||
}, Me = (e) => Ke.create({ | ||
}, Me = (e) => Qe.create({ | ||
doc: e.options.doc, | ||
selection: tn(e.options.selections), | ||
selection: nn(e.options.selections), | ||
extensions: [ | ||
Ot(), | ||
Kt(), | ||
it(), | ||
Yt(), | ||
Gt(), | ||
Rt(), | ||
Qt(), | ||
at(), | ||
Zt(), | ||
Jt(), | ||
en(), | ||
...pt(e) | ||
tn(), | ||
...gt(e) | ||
] | ||
}), nn = ([e, t], n) => { | ||
}), on = ([e, t], n) => { | ||
t(Y(e(), { options: { doc: n } })), e().editor.setState(Me(e())); | ||
}, on = ([e]) => e().options, rn = async ([e, t], n) => { | ||
}, rn = ([e]) => e().options, an = async ([e, t], n) => { | ||
const o = t(Y(e(), { options: n })), r = await ce(o); | ||
@@ -729,4 +737,4 @@ o.editor.dispatch({ effects: r }); | ||
if (t.at) | ||
return an(e, t.at); | ||
}, an = (e, t) => { | ||
return ln(e, t.at); | ||
}, ln = (e, t) => { | ||
const [n] = e; | ||
@@ -746,3 +754,3 @@ if (t === oe.Start) | ||
); | ||
}, ae = (e, t) => Ae(e, [t]), ln = ([e], t) => { | ||
}, ae = (e, t) => Ae(e, [t]), sn = ([e], t) => { | ||
const { editor: n } = e(); | ||
@@ -758,20 +766,20 @@ n.dispatch( | ||
); | ||
}, sn = ([e, t], { after: n, before: o, selection: r }) => { | ||
}, cn = ([e, t], { after: n, before: o, selection: r }) => { | ||
const { editor: i } = e(), a = r || fe([e, t]).pop() || { start: 0, end: 0 }, s = i.state.sliceDoc(a.start, a.end); | ||
ee([e, t], `${o}${s}${n}`, a), He([e, t], { selections: [{ start: a.start + o.length, end: a.end + o.length }] }); | ||
}, ze = (e) => ({ | ||
destroy: yt.bind(void 0, e), | ||
destroy: $t.bind(void 0, e), | ||
focus: ie.bind(void 0, e), | ||
format: Le.bind(void 0, e), | ||
getDoc: zt.bind(void 0, e), | ||
getDoc: Et.bind(void 0, e), | ||
insert: ee.bind(void 0, e), | ||
load: nn.bind(void 0, e), | ||
options: on.bind(void 0, e), | ||
reconfigure: rn.bind(void 0, e), | ||
load: on.bind(void 0, e), | ||
options: rn.bind(void 0, e), | ||
reconfigure: an.bind(void 0, e), | ||
select: He.bind(void 0, e), | ||
selections: fe.bind(void 0, e), | ||
update: ln.bind(void 0, e), | ||
wrap: sn.bind(void 0, e) | ||
}), cn = `.ink-drop-zone{align-items:center;background-color:#00000080;color:var(--ink-internal-color);display:flex;inset:0;justify-content:center;position:var(--ink-internal-modal-position);z-index:100}.ink-drop-zone:not(.visible){display:none}.ink-drop-zone-modal{background-color:var(--ink-internal-block-background-color);border-radius:var(--ink-internal-border-radius);box-sizing:border-box;height:100%;max-height:20rem;max-width:40rem;padding:1rem;position:relative;width:100%}.ink-drop-zone-hide{cursor:pointer;height:1.75rem;position:absolute;right:.25rem;top:.25rem;width:1.75rem}.ink-drop-zone-hide svg{background-color:var(--ink-internal-block-background-color)}.ink-drop-zone-droppable-area{align-items:center;border:.2rem dashed var(--ink-internal-color);border-radius:.125rem;box-sizing:border-box;display:flex;flex-direction:column;font-size:1.25em;gap:1rem;height:100%;justify-content:center;padding:1rem;text-align:center}.ink-drop-zone-file-preview{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem;max-width:25.5rem}.ink-drop-zone-file-preview-image{border:.125rem solid #222;border-radius:.125rem;box-sizing:border-box;height:6rem;object-fit:cover;padding:.5rem;width:6rem} | ||
`, dn = /* @__PURE__ */ g("<span>uploading files...</span>", 2), un = /* @__PURE__ */ g('<div class="ink-drop-zone"><style></style><div class="ink-drop-zone-modal"><div class="ink-drop-zone-droppable-area"><div class="ink-drop-zone-file-preview"></div><!#><!/></div><div class="ink-drop-zone-hide"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div></div></div>', 18), fn = /* @__PURE__ */ g('<img class="ink-drop-zone-file-preview-image">', 1), mn = /* @__PURE__ */ g("<span>drop files here</span>", 2), pn = () => { | ||
update: sn.bind(void 0, e), | ||
wrap: cn.bind(void 0, e) | ||
}), dn = `.ink-drop-zone{align-items:center;background-color:#00000080;color:var(--ink-internal-color);display:flex;inset:0;justify-content:center;position:var(--ink-internal-modal-position);z-index:100}.ink-drop-zone:not(.visible){display:none}.ink-drop-zone-modal{background-color:var(--ink-internal-block-background-color);border-radius:var(--ink-internal-border-radius);box-sizing:border-box;height:100%;max-height:20rem;max-width:40rem;padding:1rem;position:relative;width:100%}.ink-drop-zone-hide{cursor:pointer;height:1.75rem;position:absolute;right:.25rem;top:.25rem;width:1.75rem}.ink-drop-zone-hide svg{background-color:var(--ink-internal-block-background-color)}.ink-drop-zone-droppable-area{align-items:center;border:.2rem dashed var(--ink-internal-color);border-radius:.125rem;box-sizing:border-box;display:flex;flex-direction:column;font-size:1.25em;gap:1rem;height:100%;justify-content:center;padding:1rem;text-align:center}.ink-drop-zone-file-preview{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem;max-width:25.5rem}.ink-drop-zone-file-preview-image{border:.125rem solid #222;border-radius:.125rem;box-sizing:border-box;height:6rem;object-fit:cover;padding:.5rem;width:6rem} | ||
`, un = /* @__PURE__ */ p("<span>uploading files...</span>", 2), fn = /* @__PURE__ */ p('<div class="ink-drop-zone"><style></style><div class="ink-drop-zone-modal"><div class="ink-drop-zone-droppable-area"><div class="ink-drop-zone-file-preview"></div><!#><!/></div><div class="ink-drop-zone-hide"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div></div></div>', 18), mn = /* @__PURE__ */ p('<img class="ink-drop-zone-file-preview-image">', 1), pn = /* @__PURE__ */ p("<span>drop files here</span>", 2), gn = () => { | ||
const [e, t] = R(0), [n, o] = R([]), [r, i] = R(!1), [a, s] = R(!1), [c, u] = U(), v = () => { | ||
@@ -789,3 +797,3 @@ s(!1); | ||
c().options.files.dragAndDrop && (h.preventDefault(), t(e() - 1), e() === 0 && s(!1)); | ||
}, E = (h) => { | ||
}, B = (h) => { | ||
c().options.files.dragAndDrop && (h.preventDefault(), s(!0)); | ||
@@ -813,8 +821,8 @@ }, q = (h) => { | ||
return be(() => { | ||
document.addEventListener("dragenter", w), document.addEventListener("dragleave", L), document.addEventListener("dragover", E), document.addEventListener("drop", q), c().root.addEventListener("paste", I); | ||
}), qe(() => { | ||
document.removeEventListener("dragenter", w), document.removeEventListener("dragleave", L), document.removeEventListener("dragover", E), document.removeEventListener("drop", q), c().root.removeEventListener("paste", I); | ||
document.addEventListener("dragenter", w), document.addEventListener("dragleave", L), document.addEventListener("dragover", B), document.addEventListener("drop", q), c().root.addEventListener("paste", I); | ||
}), Ie(() => { | ||
document.removeEventListener("dragenter", w), document.removeEventListener("dragleave", L), document.removeEventListener("dragover", B), document.removeEventListener("drop", q), c().root.removeEventListener("paste", I); | ||
}), (() => { | ||
const h = f(un), y = h.firstChild, K = y.nextSibling, N = K.firstChild, p = N.firstChild, j = p.nextSibling, [C, D] = k(j.nextSibling), T = N.nextSibling; | ||
return y.textContent = cn, N.addEventListener("drop", _), m(p, l(Ie, { | ||
const h = f(fn), y = h.firstChild, K = y.nextSibling, N = K.firstChild, g = N.firstChild, j = g.nextSibling, [C, D] = k(j.nextSibling), T = N.nextSibling; | ||
return y.textContent = dn, N.addEventListener("drop", _), m(g, l(Ne, { | ||
get each() { | ||
@@ -824,6 +832,6 @@ return n().slice(0, 8); | ||
children: ($) => (() => { | ||
const H = f(fn); | ||
const H = f(mn); | ||
return ne((S) => { | ||
const z = $.name, B = URL.createObjectURL($); | ||
return z !== S._v$ && pe(H, "alt", S._v$ = z), B !== S._v$2 && pe(H, "src", S._v$2 = B), S; | ||
const z = $.name, E = URL.createObjectURL($); | ||
return z !== S._v$ && pe(H, "alt", S._v$ = z), E !== S._v$2 && pe(H, "src", S._v$2 = E), S; | ||
}, { | ||
@@ -839,6 +847,6 @@ _v$: void 0, | ||
get fallback() { | ||
return f(mn); | ||
return f(pn); | ||
}, | ||
get children() { | ||
return f(dn); | ||
return f(un); | ||
} | ||
@@ -849,3 +857,3 @@ }), C, D), T.$$click = v, ne(() => h.classList.toggle("visible", !!a())), le(), h; | ||
ke(["click"]); | ||
const gn = ([e, t]) => { | ||
const kn = ([e, t]) => { | ||
const n = new Q({ | ||
@@ -859,4 +867,4 @@ dispatch: (o) => { | ||
return n; | ||
}, kn = () => { | ||
const [e, t] = U(), n = gn([e, t]); | ||
}, hn = () => { | ||
const [e, t] = U(), n = kn([e, t]); | ||
return t(Y(e(), { | ||
@@ -869,9 +877,9 @@ editor: n | ||
}), n.dom; | ||
}, hn = /* @__PURE__ */ g('<button class="ink-button" type="button"></button>', 2), M = (e) => (() => { | ||
const t = f(hn); | ||
}, bn = /* @__PURE__ */ p('<button class="ink-button" type="button"></button>', 2), M = (e) => (() => { | ||
const t = f(bn); | ||
return t.$$click = (n) => e.onclick(n), m(t, () => e.children), le(), t; | ||
})(); | ||
ke(["click"]); | ||
const bn = `.ink-mde .ink-mde-toolbar{background-color:var(--ink-internal-block-background-color);color:inherit;display:flex;flex-shrink:0;overflow-x:auto;padding:.25rem}.ink-mde .ink-mde-toolbar .ink-mde-container{display:flex;gap:var(--ink-internal-toolbar-group-spacing)}.ink-mde .ink-mde-toolbar-group{display:flex;gap:var(--ink-internal-toolbar-item-spacing)}.ink-mde .ink-mde-toolbar .ink-button{align-items:center;background:none;border:none;border-radius:var(--ink-internal-border-radius);color:inherit;cursor:pointer;display:flex;height:2.25rem;justify-content:center;padding:.4rem;width:2.25rem}.ink-mde .ink-mde-toolbar .ink-button:hover{background-color:var(--ink-internal-block-background-color-on-hover)}.ink-mde .ink-mde-toolbar .ink-button>*{align-items:center;display:flex;height:100%} | ||
`, xn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4V10M6 16V10M6 10H14M14 10V4M14 10V16"></path></svg>', 4), vn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 10H10.5C12.1569 10 13.5 11.3431 13.5 13C13.5 14.6569 12.1569 16 10.5 16H6.5V4H9.5C11.1569 4 12.5 5.34315 12.5 7C12.5 8.65686 11.1569 10 9.5 10"></path></svg>', 4), yn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4L9 16M13 4H9M7 16H11"></path></svg>', 4), G = /* @__PURE__ */ g('<div class="ink-mde-toolbar-group"><!#><!/><!#><!/><!#><!/></div>', 8), $n = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.00257 16H17.9955M2.00055 4H18M7 10H18.0659M2 8.5V11.4999C2.4 11.5 2.5 11.5 2.5 11.5V11V10.5M4 8.5V11.4999H4.5V11V10.5"></path></svg>', 4), _n = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4L7 16"></path><path d="M5 7L2 10L5 13"></path><path d="M15 7L18 10L15 13"></path></svg>', 8), wn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4L8 6"></path></svg>', 4), Cn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 16H17.8294"></path><path d="M2 16H4"></path><path d="M7 10H17.8294"></path><path d="M2 10H4"></path><path d="M7 4H17.8294"></path><path d="M2 4H4"></path></svg>', 14), Sn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 16H18"></path><path d="M2 17.0242C2.48314 17.7569 3.94052 17.6154 3.99486 16.7919C4.05315 15.9169 3.1975 16.0044 2.99496 16.0044M2.0023 14.9758C2.48544 14.2431 3.94282 14.3846 3.99716 15.2081C4.05545 16.0831 3.1998 16.0002 2.99726 16.0002"></path><path d="M7 10H18"></path><path d="M2.00501 11.5H4M2.00193 8.97562C2.48449 8.24319 3.9401 8.38467 3.99437 9.20777C4.05259 10.0825 2.04342 10.5788 2 11.4996"></path><path d="M7 4H18"></path><path d="M2 5.5H4M2.99713 5.49952V2.5L2.215 2.93501"></path></svg>', 14), Ln = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 16H17.8294"></path><path d="M5 15L3 17L2 16"></path><path d="M7 10H17.8294"></path><path d="M5 9L3 11L2 10"></path><path d="M7 4H17.8294"></path><path d="M5 3L3 5L2 4"></path></svg>', 14), Mn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M9.12127 10.881C10.02 11.78 11.5237 11.7349 12.4771 10.7813L15.2546 8.00302C16.2079 7.04937 16.253 5.54521 15.3542 4.6462C14.4555 3.74719 12.9512 3.79174 11.9979 4.74539L10.3437 6.40007M10.8787 9.11903C9.97997 8.22002 8.47626 8.26509 7.52288 9.21874L4.74545 11.997C3.79208 12.9506 3.74701 14.4548 4.64577 15.3538C5.54452 16.2528 7.04876 16.2083 8.00213 15.2546L9.65633 13.5999"></path></svg>', 4), Hn = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="16" height="12" rx="1"></rect><path d="M7.42659 7.67597L13.7751 13.8831M2.00208 12.9778L7.42844 7.67175"></path><path d="M11.9119 12.0599L14.484 9.54443L17.9973 12.9785"></path><path d="M10.9989 7.95832C11.551 7.95832 11.9986 7.52072 11.9986 6.98092C11.9986 6.44113 11.551 6.00354 10.9989 6.00354C10.4468 6.00354 9.99921 6.44113 9.99921 6.98092C9.99921 7.52072 10.4468 7.95832 10.9989 7.95832Z"></path></svg>', 10), An = /* @__PURE__ */ g('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13V4M10 4L13 7M10 4L7 7"></path><path d="M2 13V15C2 15.5523 2.44772 16 3 16H17C17.5523 16 18 15.5523 18 15V13"></path></svg>', 6), zn = /* @__PURE__ */ g('<input type="file">', 1), Bn = /* @__PURE__ */ g('<div class="ink-mde-toolbar"><style></style><div class="ink-mde-container"><!#><!/><!#><!/><!#><!/><!#><!/></div></div>', 14), En = () => { | ||
const xn = `.ink-mde .ink-mde-toolbar{background-color:var(--ink-internal-block-background-color);color:inherit;display:flex;flex-shrink:0;overflow-x:auto;padding:.25rem}.ink-mde .ink-mde-toolbar .ink-mde-container{display:flex;gap:var(--ink-internal-toolbar-group-spacing)}.ink-mde .ink-mde-toolbar-group{display:flex;gap:var(--ink-internal-toolbar-item-spacing)}.ink-mde .ink-mde-toolbar .ink-button{align-items:center;background:none;border:none;border-radius:var(--ink-internal-border-radius);color:inherit;cursor:pointer;display:flex;height:2.25rem;justify-content:center;padding:.4rem;width:2.25rem}.ink-mde .ink-mde-toolbar .ink-button:hover{background-color:var(--ink-internal-block-background-color-on-hover)}.ink-mde .ink-mde-toolbar .ink-button>*{align-items:center;display:flex;height:100%} | ||
`, vn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4V10M6 16V10M6 10H14M14 10V4M14 10V16"></path></svg>', 4), yn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 10H10.5C12.1569 10 13.5 11.3431 13.5 13C13.5 14.6569 12.1569 16 10.5 16H6.5V4H9.5C11.1569 4 12.5 5.34315 12.5 7C12.5 8.65686 11.1569 10 9.5 10"></path></svg>', 4), $n = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4L9 16M13 4H9M7 16H11"></path></svg>', 4), G = /* @__PURE__ */ p('<div class="ink-mde-toolbar-group"><!#><!/><!#><!/><!#><!/></div>', 8), _n = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.00257 16H17.9955M2.00055 4H18M7 10H18.0659M2 8.5V11.4999C2.4 11.5 2.5 11.5 2.5 11.5V11V10.5M4 8.5V11.4999H4.5V11V10.5"></path></svg>', 4), wn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4L7 16"></path><path d="M5 7L2 10L5 13"></path><path d="M15 7L18 10L15 13"></path></svg>', 8), Cn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4L8 6"></path></svg>', 4), Sn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 16H17.8294"></path><path d="M2 16H4"></path><path d="M7 10H17.8294"></path><path d="M2 10H4"></path><path d="M7 4H17.8294"></path><path d="M2 4H4"></path></svg>', 14), Ln = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 16H18"></path><path d="M2 17.0242C2.48314 17.7569 3.94052 17.6154 3.99486 16.7919C4.05315 15.9169 3.1975 16.0044 2.99496 16.0044M2.0023 14.9758C2.48544 14.2431 3.94282 14.3846 3.99716 15.2081C4.05545 16.0831 3.1998 16.0002 2.99726 16.0002"></path><path d="M7 10H18"></path><path d="M2.00501 11.5H4M2.00193 8.97562C2.48449 8.24319 3.9401 8.38467 3.99437 9.20777C4.05259 10.0825 2.04342 10.5788 2 11.4996"></path><path d="M7 4H18"></path><path d="M2 5.5H4M2.99713 5.49952V2.5L2.215 2.93501"></path></svg>', 14), Mn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 16H17.8294"></path><path d="M5 15L3 17L2 16"></path><path d="M7 10H17.8294"></path><path d="M5 9L3 11L2 10"></path><path d="M7 4H17.8294"></path><path d="M5 3L3 5L2 4"></path></svg>', 14), Hn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M9.12127 10.881C10.02 11.78 11.5237 11.7349 12.4771 10.7813L15.2546 8.00302C16.2079 7.04937 16.253 5.54521 15.3542 4.6462C14.4555 3.74719 12.9512 3.79174 11.9979 4.74539L10.3437 6.40007M10.8787 9.11903C9.97997 8.22002 8.47626 8.26509 7.52288 9.21874L4.74545 11.997C3.79208 12.9506 3.74701 14.4548 4.64577 15.3538C5.54452 16.2528 7.04876 16.2083 8.00213 15.2546L9.65633 13.5999"></path></svg>', 4), An = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="16" height="12" rx="1"></rect><path d="M7.42659 7.67597L13.7751 13.8831M2.00208 12.9778L7.42844 7.67175"></path><path d="M11.9119 12.0599L14.484 9.54443L17.9973 12.9785"></path><path d="M10.9989 7.95832C11.551 7.95832 11.9986 7.52072 11.9986 6.98092C11.9986 6.44113 11.551 6.00354 10.9989 6.00354C10.4468 6.00354 9.99921 6.44113 9.99921 6.98092C9.99921 7.52072 10.4468 7.95832 10.9989 7.95832Z"></path></svg>', 10), zn = /* @__PURE__ */ p('<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-miterlimit="5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13V4M10 4L13 7M10 4L7 7"></path><path d="M2 13V15C2 15.5523 2.44772 16 3 16H17C17.5523 16 18 15.5523 18 15V13"></path></svg>', 6), En = /* @__PURE__ */ p('<input type="file">', 1), Bn = /* @__PURE__ */ p('<div class="ink-mde-toolbar"><style></style><div class="ink-mde-container"><!#><!/><!#><!/><!#><!/><!#><!/></div></div>', 14), jn = () => { | ||
const [e, t] = U(), [n, o] = R(), r = (s) => { | ||
@@ -889,4 +897,4 @@ Le([e, t], s), ie([e, t]); | ||
return (() => { | ||
const s = f(Bn), c = s.firstChild, u = c.nextSibling, v = u.firstChild, [_, w] = k(v.nextSibling), L = _.nextSibling, [E, q] = k(L.nextSibling), I = E.nextSibling, [X, h] = k(I.nextSibling), y = X.nextSibling, [K, N] = k(y.nextSibling); | ||
return c.textContent = bn, m(u, l(b, { | ||
const s = f(Bn), c = s.firstChild, u = c.nextSibling, v = u.firstChild, [_, w] = k(v.nextSibling), L = _.nextSibling, [B, q] = k(L.nextSibling), I = B.nextSibling, [X, h] = k(I.nextSibling), y = X.nextSibling, [K, N] = k(y.nextSibling); | ||
return c.textContent = xn, m(u, l(b, { | ||
get when() { | ||
@@ -896,4 +904,4 @@ return e().options.toolbar.heading || e().options.toolbar.bold || e().options.toolbar.italic; | ||
get children() { | ||
const p = f(G), j = p.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, B] = k(S.nextSibling); | ||
return m(p, l(b, { | ||
const g = f(G), j = g.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, E] = k(S.nextSibling); | ||
return m(g, l(b, { | ||
get when() { | ||
@@ -906,7 +914,7 @@ return e().options.toolbar.heading; | ||
get children() { | ||
return f(xn); | ||
return f(vn); | ||
} | ||
}); | ||
} | ||
}), C, D), m(p, l(b, { | ||
}), C, D), m(g, l(b, { | ||
get when() { | ||
@@ -919,7 +927,7 @@ return e().options.toolbar.bold; | ||
get children() { | ||
return f(vn); | ||
return f(yn); | ||
} | ||
}); | ||
} | ||
}), $, H), m(p, l(b, { | ||
}), $, H), m(g, l(b, { | ||
get when() { | ||
@@ -932,7 +940,7 @@ return e().options.toolbar.italic; | ||
get children() { | ||
return f(yn); | ||
return f($n); | ||
} | ||
}); | ||
} | ||
}), z, B), p; | ||
}), z, E), g; | ||
} | ||
@@ -944,4 +952,4 @@ }), _, w), m(u, l(b, { | ||
get children() { | ||
const p = f(G), j = p.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, B] = k(S.nextSibling); | ||
return m(p, l(b, { | ||
const g = f(G), j = g.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, E] = k(S.nextSibling); | ||
return m(g, l(b, { | ||
get when() { | ||
@@ -954,7 +962,7 @@ return e().options.toolbar.quote; | ||
get children() { | ||
return f($n); | ||
return f(_n); | ||
} | ||
}); | ||
} | ||
}), C, D), m(p, l(b, { | ||
}), C, D), m(g, l(b, { | ||
get when() { | ||
@@ -967,7 +975,7 @@ return e().options.toolbar.codeBlock; | ||
get children() { | ||
return f(_n); | ||
return f(wn); | ||
} | ||
}); | ||
} | ||
}), $, H), m(p, l(b, { | ||
}), $, H), m(g, l(b, { | ||
get when() { | ||
@@ -980,9 +988,9 @@ return e().options.toolbar.code; | ||
get children() { | ||
return f(wn); | ||
return f(Cn); | ||
} | ||
}); | ||
} | ||
}), z, B), p; | ||
}), z, E), g; | ||
} | ||
}), E, q), m(u, l(b, { | ||
}), B, q), m(u, l(b, { | ||
get when() { | ||
@@ -992,4 +1000,4 @@ return e().options.toolbar.list || e().options.toolbar.orderedList || e().options.toolbar.taskList; | ||
get children() { | ||
const p = f(G), j = p.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, B] = k(S.nextSibling); | ||
return m(p, l(b, { | ||
const g = f(G), j = g.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, E] = k(S.nextSibling); | ||
return m(g, l(b, { | ||
get when() { | ||
@@ -1002,7 +1010,7 @@ return e().options.toolbar.list; | ||
get children() { | ||
return f(Cn); | ||
return f(Sn); | ||
} | ||
}); | ||
} | ||
}), C, D), m(p, l(b, { | ||
}), C, D), m(g, l(b, { | ||
get when() { | ||
@@ -1015,7 +1023,7 @@ return e().options.toolbar.orderedList; | ||
get children() { | ||
return f(Sn); | ||
return f(Ln); | ||
} | ||
}); | ||
} | ||
}), $, H), m(p, l(b, { | ||
}), $, H), m(g, l(b, { | ||
get when() { | ||
@@ -1028,7 +1036,7 @@ return e().options.toolbar.taskList; | ||
get children() { | ||
return f(Ln); | ||
return f(Mn); | ||
} | ||
}); | ||
} | ||
}), z, B), p; | ||
}), z, E), g; | ||
} | ||
@@ -1040,4 +1048,4 @@ }), X, h), m(u, l(b, { | ||
get children() { | ||
const p = f(G), j = p.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, B] = k(S.nextSibling); | ||
return m(p, l(b, { | ||
const g = f(G), j = g.firstChild, [C, D] = k(j.nextSibling), T = C.nextSibling, [$, H] = k(T.nextSibling), S = $.nextSibling, [z, E] = k(S.nextSibling); | ||
return m(g, l(b, { | ||
get when() { | ||
@@ -1050,7 +1058,7 @@ return e().options.toolbar.link; | ||
get children() { | ||
return f(Mn); | ||
return f(Hn); | ||
} | ||
}); | ||
} | ||
}), C, D), m(p, l(b, { | ||
}), C, D), m(g, l(b, { | ||
get when() { | ||
@@ -1063,7 +1071,7 @@ return e().options.toolbar.image; | ||
get children() { | ||
return f(Hn); | ||
return f(An); | ||
} | ||
}); | ||
} | ||
}), $, H), m(p, l(b, { | ||
}), $, H), m(g, l(b, { | ||
get when() { | ||
@@ -1076,4 +1084,4 @@ return e().options.toolbar.upload; | ||
get children() { | ||
return [f(An), (() => { | ||
const Z = f(zn); | ||
return [f(zn), (() => { | ||
const Z = f(En); | ||
return he(o, Z), Z.addEventListener("change", i), Z.style.setProperty("display", "none"), Z; | ||
@@ -1084,19 +1092,19 @@ })()]; | ||
} | ||
}), z, B), p; | ||
}), z, E), g; | ||
} | ||
}), K, N), s; | ||
})(); | ||
}, me = 225, jn = (e, t = me) => { | ||
const n = Vn(e, t), o = On(e), r = Tn(e), i = Dn(e); | ||
}, me = 225, Dn = (e, t = me) => { | ||
const n = On(e, t), o = Rn(e), r = Vn(e), i = Tn(e); | ||
return [n, o, r, i].join(" | "); | ||
}, Dn = (e) => `${Rn(e)} chars`, Tn = (e) => `${qn(e)} lines`, Vn = (e, t = me) => { | ||
const n = In(e, t), o = Math.floor(n), r = Math.floor(n % 1 * 60); | ||
}, Tn = (e) => `${qn(e)} chars`, Vn = (e) => `${In(e)} lines`, On = (e, t = me) => { | ||
const n = Nn(e, t), o = Math.floor(n), r = Math.floor(n % 1 * 60); | ||
return o === 0 ? `${r}s read` : `${o}m ${r}s to read`; | ||
}, On = (e) => `${Be(e)} words`, Rn = (e) => e.length, qn = (e) => e.split(/\n/).length, In = (e, t = me) => Be(e) / t, Be = (e) => { | ||
}, Rn = (e) => `${Ee(e)} words`, qn = (e) => e.length, In = (e) => e.split(/\n/).length, Nn = (e, t = me) => Ee(e) / t, Ee = (e) => { | ||
const t = e.replace(/[']/g, "").replace(/[^\w\d]+/g, " ").trim(); | ||
return t ? t.split(/\s+/).length : 0; | ||
}, Nn = /* @__PURE__ */ g('<div class="ink-mde-readability"><span></span></div>', 4), Pn = /* @__PURE__ */ g("<span> |</span>", 2), Wn = /* @__PURE__ */ g('<div class="ink-mde-attribution"><span> powered by <a class="ink-mde-attribution-link" href="https://github.com/voracious/ink-mde" rel="noopener noreferrer" target="_blank">ink-mde</a></span></div>', 6), Fn = /* @__PURE__ */ g('<div class="ink-mde-details"><div class="ink-mde-container"><div class="ink-mde-details-content"><!#><!/><!#><!/><!#><!/></div></div></div>', 12), Un = () => { | ||
}, Pn = /* @__PURE__ */ p('<div class="ink-mde-readability"><span></span></div>', 4), Wn = /* @__PURE__ */ p("<span> |</span>", 2), Fn = /* @__PURE__ */ p('<div class="ink-mde-attribution"><span> powered by <a class="ink-mde-attribution-link" href="https://github.com/voracious/ink-mde" rel="noopener noreferrer" target="_blank">ink-mde</a></span></div>', 6), Un = /* @__PURE__ */ p('<div class="ink-mde-details"><div class="ink-mde-container"><div class="ink-mde-details-content"><!#><!/><!#><!/><!#><!/></div></div></div>', 12), Xn = () => { | ||
const [e] = U(); | ||
return (() => { | ||
const t = f(Fn), n = t.firstChild, o = n.firstChild, r = o.firstChild, [i, a] = k(r.nextSibling), s = i.nextSibling, [c, u] = k(s.nextSibling), v = c.nextSibling, [_, w] = k(v.nextSibling); | ||
const t = f(Un), n = t.firstChild, o = n.firstChild, r = o.firstChild, [i, a] = k(r.nextSibling), s = i.nextSibling, [c, u] = k(s.nextSibling), v = c.nextSibling, [_, w] = k(v.nextSibling); | ||
return m(o, l(b, { | ||
@@ -1107,11 +1115,11 @@ get when() { | ||
get children() { | ||
const L = f(Nn), E = L.firstChild; | ||
return m(E, () => jn(e().doc)), L; | ||
const L = f(Pn), B = L.firstChild; | ||
return m(B, () => Dn(e().doc)), L; | ||
} | ||
}), i, a), m(o, l(b, { | ||
get when() { | ||
return De(() => !!e().options.readability)() && e().options.interface.attribution; | ||
return Te(() => !!e().options.readability)() && e().options.interface.attribution; | ||
}, | ||
get children() { | ||
return f(Pn); | ||
return f(Wn); | ||
} | ||
@@ -1123,10 +1131,10 @@ }), c, u), m(o, l(b, { | ||
get children() { | ||
return f(Wn); | ||
return f(Fn); | ||
} | ||
}), _, w), t; | ||
})(); | ||
}, Xn = `.ink-mde{border:2px solid var(--ink-internal-block-background-color);border-radius:var(--ink-internal-border-radius);color:var(--ink-internal-color, inherit);display:flex;flex-direction:var(--ink-internal-flex-direction, column)}.ink-mde .cm-tooltip{background-color:var(--ink-internal-block-background-color);border-radius:var(--ink-internal-border-radius);font-family:inherit;padding:.25rem}.ink-mde .cm-tooltip.cm-tooltip-autocomplete ul{font-family:inherit}.ink-mde .cm-tooltip.cm-tooltip-autocomplete ul li.ink-tooltip-option{border-radius:var(--ink-internal-border-radius);padding:.25rem}.ink-mde .cm-tooltip.cm-tooltip-autocomplete ul li.ink-tooltip-option[aria-selected]{background-color:#96969640}.ink-mde .cm-completionLabel{font-family:inherit}.ink-mde,.ink-mde *{box-sizing:border-box}.ink-mde,.ink-mde .ink-mde-editor{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;min-height:0}.ink-mde .ink-mde-editor{overflow:auto;padding:.5rem}.ink-mde .ink-mde-toolbar,.ink-mde .ink-mde-details{display:flex;flex-grow:0;flex-shrink:0}.ink-mde .ink-mde-details{background-color:var(--ink-internal-block-background-color);display:flex;padding:.5rem}.ink-mde .ink-mde-details-content{color:inherit;display:flex;filter:brightness(.75);flex-wrap:wrap;font-size:.75em;justify-content:flex-end}.ink-mde .ink-mde-attribution{display:flex;justify-content:flex-end}.ink-mde .ink-mde-attribution-link{color:currentColor;font-weight:600;text-decoration:none}.ink-mde .ink-mde-container{margin-left:auto;margin-right:auto;width:100%}.ink-mde .ink-mde-task-toggle{cursor:pointer;height:1rem;line-height:2em;margin:0 .25rem 0 0;position:relative;top:-1px;vertical-align:middle;width:1rem}.ink-mde .cm-editor{display:flex;flex-direction:column;position:relative}.ink-mde .cm-scroller{align-items:flex-start;display:flex;font-family:var(--ink-internal-font-family);font-size:var(--ink-internal-editor-font-size);line-height:var(--ink-internal-editor-line-height);overflow-x:auto;position:relative}.ink-mde .cm-content{display:block;flex-grow:2;flex-shrink:0;margin:0;outline:none;padding:0;white-space:pre;word-wrap:normal}.ink-mde .cm-lineWrapping{flex-shrink:1;overflow-wrap:anywhere;white-space:break-spaces;word-break:break-word}.ink-mde .cm-line{font-family:var(--ink-internal-font-family);padding:0}.ink-mde .cm-line.cm-blockquote{background-color:var(--ink-internal-block-background-color);border-left:.25rem solid currentColor;padding:0 var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-blockquote.cm-blockquote-open{border-top-left-radius:var(--ink-internal-border-radius);border-top-right-radius:var(--ink-internal-border-radius);padding-top:var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-blockquote.cm-blockquote-close{border-bottom-left-radius:var(--ink-internal-border-radius);border-bottom-right-radius:var(--ink-internal-border-radius);padding-bottom:var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-codeblock{background-color:var(--ink-internal-block-background-color);font-family:var(--ink-internal-code-font-family);padding:0 var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-codeblock.cm-codeblock-open{border-radius:var(--ink-internal-border-radius) var(--ink-internal-border-radius) 0 0;padding-top:var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-codeblock.cm-codeblock-close{border-radius:0 0 var(--ink-internal-border-radius) var(--ink-internal-border-radius);padding-bottom:var(--ink-internal-block-padding)}.ink-mde .cm-line .cm-code{background-color:var(--ink-internal-block-background-color);font-family:var(--ink-internal-code-font-family);padding:var(--ink-internal-inline-padding) 0}.ink-mde .cm-line .cm-code.cm-code-open{border-radius:var(--ink-internal-border-radius) 0 0 var(--ink-internal-border-radius);padding-left:var(--ink-internal-inline-padding)}.ink-mde .cm-line .cm-code.cm-code-close{border-radius:0 var(--ink-internal-border-radius) var(--ink-internal-border-radius) 0;padding-right:var(--ink-internal-inline-padding)}.ink-mde .cm-image-backdrop{background-color:var(--ink-internal-block-background-color)} | ||
`, Kn = /* @__PURE__ */ g("<style> </style>", 2), Qn = () => { | ||
}, Kn = `.ink-mde{border:2px solid var(--ink-internal-block-background-color);border-radius:var(--ink-internal-border-radius);color:var(--ink-internal-color, inherit);display:flex;flex-direction:var(--ink-internal-flex-direction, column)}.ink-mde .cm-tooltip{background-color:var(--ink-internal-block-background-color);border-radius:var(--ink-internal-border-radius);font-family:inherit;padding:.25rem}.ink-mde .cm-tooltip.cm-tooltip-autocomplete ul{font-family:inherit}.ink-mde .cm-tooltip.cm-tooltip-autocomplete ul li.ink-tooltip-option{border-radius:var(--ink-internal-border-radius);padding:.25rem}.ink-mde .cm-tooltip.cm-tooltip-autocomplete ul li.ink-tooltip-option[aria-selected]{background-color:#96969640}.ink-mde .cm-completionLabel{font-family:inherit}.ink-mde,.ink-mde *{box-sizing:border-box}.ink-mde span{display:inline-block}.ink-mde,.ink-mde .ink-mde-editor{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;min-height:0}.ink-mde .ink-mde-editor{overflow:auto;padding:.5rem}.ink-mde .ink-mde-toolbar,.ink-mde .ink-mde-details{display:flex;flex-grow:0;flex-shrink:0}.ink-mde .ink-mde-details{background-color:var(--ink-internal-block-background-color);display:flex;padding:.5rem}.ink-mde .ink-mde-details-content{color:inherit;display:flex;filter:brightness(.75);flex-wrap:wrap;font-size:.75em;justify-content:flex-end}.ink-mde .ink-mde-attribution{display:flex;justify-content:flex-end}.ink-mde .ink-mde-attribution-link{color:currentColor;font-weight:600;text-decoration:none}.ink-mde .ink-mde-container{margin-left:auto;margin-right:auto;width:100%}.ink-mde .ink-mde-search-panel{background-color:var(--ink-internal-block-background-color);border-radius:.25rem;padding:.25rem;position:absolute;right:.25rem;top:.25rem;width:clamp(10rem,30%,100%)}.ink-mde .ink-mde-search-panel:focus-within{outline-color:#6495ed;outline-style:solid}.ink-mde .ink-mde-search-input{background-color:transparent;border:none;border-radius:.25rem;color:inherit;font-size:inherit;outline:none;width:100%}.ink-mde .ink-mde-task-toggle{cursor:pointer;height:1rem;line-height:2em;margin:0 .25rem 0 0;position:relative;top:-1px;vertical-align:middle;width:1rem}.ink-mde .cm-editor{display:flex;flex-direction:column;position:relative}.ink-mde .cm-panels{background-color:unset;border:unset;z-index:10}.ink-mde .cm-searchMatch{background-color:#6495ed50}.ink-mde .cm-searchMatch-selected{background-color:#6495edcc}.ink-mde .cm-scroller{align-items:flex-start;display:flex;font-family:var(--ink-internal-font-family);font-size:var(--ink-internal-editor-font-size);line-height:var(--ink-internal-editor-line-height);overflow-x:auto;position:relative}.ink-mde .cm-content{display:block;flex-grow:2;flex-shrink:0;margin:0;outline:none;padding:0;white-space:pre;word-wrap:normal}.ink-mde .cm-lineWrapping{flex-shrink:1;overflow-wrap:anywhere;white-space:break-spaces;word-break:break-word}.ink-mde .cm-line{font-family:var(--ink-internal-font-family);padding:0}.ink-mde .cm-line.cm-blockquote{background-color:var(--ink-internal-block-background-color);border-left:.25rem solid currentColor;padding:0 var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-blockquote.cm-blockquote-open{border-top-left-radius:var(--ink-internal-border-radius);border-top-right-radius:var(--ink-internal-border-radius);padding-top:var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-blockquote.cm-blockquote-close{border-bottom-left-radius:var(--ink-internal-border-radius);border-bottom-right-radius:var(--ink-internal-border-radius);padding-bottom:var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-codeblock{background-color:var(--ink-internal-block-background-color);font-family:var(--ink-internal-code-font-family);padding:0 var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-codeblock.cm-codeblock-open{border-radius:var(--ink-internal-border-radius) var(--ink-internal-border-radius) 0 0;padding-top:var(--ink-internal-block-padding)}.ink-mde .cm-line.cm-codeblock.cm-codeblock-close{border-radius:0 0 var(--ink-internal-border-radius) var(--ink-internal-border-radius);padding-bottom:var(--ink-internal-block-padding)}.ink-mde .cm-line .cm-code{background-color:var(--ink-internal-block-background-color);font-family:var(--ink-internal-code-font-family);padding:var(--ink-internal-inline-padding) 0}.ink-mde .cm-line .cm-code.cm-code-open{border-radius:var(--ink-internal-border-radius) 0 0 var(--ink-internal-border-radius);padding-left:var(--ink-internal-inline-padding)}.ink-mde .cm-line .cm-code.cm-code-close{border-radius:0 var(--ink-internal-border-radius) var(--ink-internal-border-radius) 0;padding-right:var(--ink-internal-inline-padding)}.ink-mde .cm-image-backdrop{background-color:var(--ink-internal-block-background-color)} | ||
`, Qn = /* @__PURE__ */ p("<style> </style>", 2), Yn = () => { | ||
const [e] = U(), [t, n] = R(te(e())); | ||
return Ne(() => { | ||
return Pe(() => { | ||
n(te(e())); | ||
@@ -1147,3 +1155,3 @@ }), be(() => { | ||
}), (() => { | ||
const o = f(Kn), r = o.firstChild; | ||
const o = f(Qn), r = o.firstChild; | ||
return ne(() => r.data = `.ink { | ||
@@ -1153,5 +1161,5 @@ ${t().join(` | ||
} | ||
${Xn}`), o; | ||
${Kn}`), o; | ||
})(); | ||
}, Yn = /* @__PURE__ */ g('<div class="ink ink-mde"><!#><!/><!#><!/><!#><!/><div class="ink-mde-editor"></div><!#><!/></div>', 12), Zn = () => { | ||
}, Zn = /* @__PURE__ */ p('<div class="ink ink-mde"><!#><!/><!#><!/><!#><!/><div class="ink-mde-editor"></div><!#><!/></div>', 12), Gn = () => { | ||
const [e, t] = U(), n = (o) => { | ||
@@ -1163,4 +1171,4 @@ t(Y(e(), { | ||
return (() => { | ||
const o = f(Yn), r = o.firstChild, [i, a] = k(r.nextSibling), s = i.nextSibling, [c, u] = k(s.nextSibling), v = c.nextSibling, [_, w] = k(v.nextSibling), L = _.nextSibling, E = L.nextSibling, [q, I] = k(E.nextSibling); | ||
return he(n, o), Te(o, Ve(st), !1, !0), m(o, l(Qn, {}), i, a), m(o, l(b, { | ||
const o = f(Zn), r = o.firstChild, [i, a] = k(r.nextSibling), s = i.nextSibling, [c, u] = k(s.nextSibling), v = c.nextSibling, [_, w] = k(v.nextSibling), L = _.nextSibling, B = L.nextSibling, [q, I] = k(B.nextSibling); | ||
return he(n, o), Ve(o, Oe(ct), !1, !0), m(o, l(Yn, {}), i, a), m(o, l(b, { | ||
get when() { | ||
@@ -1170,3 +1178,3 @@ return e().options.files.clipboard || e().options.files.dragAndDrop; | ||
get children() { | ||
return l(pn, {}); | ||
return l(gn, {}); | ||
} | ||
@@ -1178,5 +1186,5 @@ }), c, u), m(o, l(b, { | ||
get children() { | ||
return l(En, {}); | ||
return l(jn, {}); | ||
} | ||
}), _, w), m(L, l(kn, {})), m(o, l(b, { | ||
}), _, w), m(L, l(hn, {})), m(o, l(b, { | ||
get when() { | ||
@@ -1186,3 +1194,3 @@ return e().options.readability || e().options.interface.attribution; | ||
get children() { | ||
return l(Un, { | ||
return l(Xn, { | ||
store: [e, t] | ||
@@ -1193,3 +1201,3 @@ }); | ||
})(); | ||
}, Ee = Pe([() => re(), (e) => typeof e == "function" ? e(re()) : e]), Gn = (e) => l(Ee.Provider, { | ||
}, Be = We([() => re(), (e) => typeof e == "function" ? e(re()) : e]), Jn = (e) => l(Be.Provider, { | ||
get value() { | ||
@@ -1201,3 +1209,3 @@ return e.store; | ||
} | ||
}), U = () => We(Ee), je = (e) => l(Gn, { | ||
}), U = () => Fe(Be), je = (e) => l(Jn, { | ||
get store() { | ||
@@ -1207,3 +1215,3 @@ return e.store; | ||
get children() { | ||
return l(Zn, { | ||
return l(Gn, { | ||
get store() { | ||
@@ -1214,13 +1222,13 @@ return e.store; | ||
} | ||
}), fo = (e) => e, Jn = (e, t = {}) => { | ||
}), eo = /* @__PURE__ */ p('<div class="ink-mde-textarea"></div>', 2), mo = (e) => e, to = (e, t = {}) => { | ||
const n = de(t); | ||
return to(), Oe(() => l(je, { | ||
return no(), Re(() => l(je, { | ||
store: n | ||
}), e), ze(n); | ||
}, mo = (e, t = {}) => e.querySelector(lt) ? Jn(e, t) : eo(e, t), eo = (e, t = {}) => { | ||
}, po = (e, t = {}) => e.querySelector(st) ? to(e, t) : De(e, t), De = (e, t = {}) => { | ||
const n = de(t); | ||
return Re(() => l(je, { | ||
return qe(() => l(je, { | ||
store: n | ||
}), e), ze(n); | ||
}, po = (e = {}) => (de(e), ""), to = () => { | ||
}, go = (e = {}) => (de(e), ""), no = () => { | ||
let e, t; | ||
@@ -1244,17 +1252,25 @@ e = window._$HY || (window._$HY = { | ||
}; | ||
}, ko = (e, t = {}) => { | ||
const n = f(eo); | ||
e.after(n), e.style.display = "none"; | ||
const o = De(e, t); | ||
return e.form && e.form.addEventListener("submit", () => { | ||
e.value = o.getDoc(); | ||
}), o; | ||
}; | ||
export { | ||
W as Appearance, | ||
ut as Extensions, | ||
ft as Extensions, | ||
x as Markup, | ||
J as PluginType, | ||
oe as Selection, | ||
mo as default, | ||
fo as defineOptions, | ||
Jn as hydrate, | ||
mo as ink, | ||
eo as render, | ||
po as renderToString, | ||
to as solidPrepareForHydration | ||
po as default, | ||
mo as defineOptions, | ||
to as hydrate, | ||
po as ink, | ||
De as render, | ||
go as renderToString, | ||
no as solidPrepareForHydration, | ||
ko as wrap | ||
}; | ||
//# sourceMappingURL=client.js.map |
@@ -29,3 +29,3 @@ // Type definitions for ink-mde | ||
getDoc: () => string | ||
insert: (text: string, selection: Editor.Selection) => void | ||
insert: (text: string, selection?: Editor.Selection) => void | ||
load: (doc: string) => void | ||
@@ -104,2 +104,3 @@ options: () => OptionsResolved | ||
readability: boolean, | ||
search: boolean, | ||
selections: Editor.Selection[], | ||
@@ -106,0 +107,0 @@ toolbar: Required<Options.Toolbar>, |
{ | ||
"name": "ink-mde", | ||
"type": "module", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"packageManager": "pnpm@7.27.0", | ||
@@ -103,3 +103,3 @@ "description": "A beautiful, modern, customizable Markdown editor powered by CodeMirror 6 and TypeScript.", | ||
"@codemirror/autocomplete": "^6.4.2", | ||
"@codemirror/commands": "^6.2.1", | ||
"@codemirror/commands": "^6.2.2", | ||
"@codemirror/lang-markdown": "^6.1.0", | ||
@@ -110,10 +110,10 @@ "@codemirror/language": "^6.6.0", | ||
"@codemirror/state": "^6.2.0", | ||
"@codemirror/view": "^6.9.1", | ||
"@codemirror/view": "^6.9.2", | ||
"@lezer/common": "^1.0.2", | ||
"@lezer/highlight": "^1.1.3", | ||
"@lezer/markdown": "^1.0.2", | ||
"@replit/codemirror-vim": "^6.0.8", | ||
"@replit/codemirror-vim": "^6.0.9", | ||
"solid-js": "^1.6.11", | ||
"style-mod": "^4.0.0", | ||
"ink-mde": "0.23.0" | ||
"ink-mde": "0.24.0" | ||
}, | ||
@@ -120,0 +120,0 @@ "devDependencies": { |
@@ -26,2 +26,3 @@ [![NPM Package](https://img.shields.io/npm/v/ink-mde?color=blue&style=for-the-badge)](https://npmjs.com/package/ink-mde) | ||
- [x] Supports Server-Side Rendering (SSR) | ||
- [x] Wrap a native `textarea` element with the `wrap` export | ||
- [x] Plugin API (experimental) | ||
@@ -68,3 +69,3 @@ | ||
// ./examples/minimal.ts | ||
import ink from 'ink-mde' | ||
import { ink } from 'ink-mde' | ||
@@ -75,2 +76,12 @@ // The only requirement is an HTML element. | ||
##### Wrap a native `textarea` with `wrap` | ||
To wrap a native `textarea` element, use the `wrap` export. | ||
```ts | ||
import { wrap } from 'ink-mde' | ||
wrap(document.querySelector('textarea')!) | ||
``` | ||
#### Track state changes with hooks | ||
@@ -200,3 +211,3 @@ | ||
```ts | ||
// ./src/store.ts#L10-L52 | ||
// ./src/store.ts#L10-L53 | ||
const options = { | ||
@@ -228,2 +239,3 @@ doc: '', | ||
readability: false, | ||
search: true, | ||
selections: [], | ||
@@ -230,0 +242,0 @@ toolbar: { |
@@ -29,3 +29,3 @@ // Type definitions for ink-mde | ||
getDoc: () => string | ||
insert: (text: string, selection: Editor.Selection) => void | ||
insert: (text: string, selection?: Editor.Selection) => void | ||
load: (doc: string) => void | ||
@@ -104,2 +104,3 @@ options: () => OptionsResolved | ||
readability: boolean, | ||
search: boolean, | ||
selections: Editor.Selection[], | ||
@@ -106,0 +107,0 @@ toolbar: Required<Options.Toolbar>, |
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 too big to display
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
982179
69
8319
374
Updated@codemirror/commands@^6.2.2
Updated@codemirror/view@^6.9.2
Updatedink-mde@0.24.0