Comparing version 0.22.0 to 0.23.0
1028
dist/client.js
@@ -1,11 +0,11 @@ | ||
import { getNextElement as f, getNextMarker as b, insert as p, createComponent as l, effect as ne, setAttribute as be, runHydrationEvents as se, delegateEvents as ve, template as m, use as ye, memo as Ge, spread as Je, mergeProps as et, hydrate as tt, render as nt } from "solid-js/web"; | ||
import { createSignal as B, onMount as $e, onCleanup as rt, For as ot, Show as x, createEffect as it, createContext as at, useContext as st } from "solid-js"; | ||
import { Compartment as we, SelectionRange as lt, EditorSelection as dt, RangeSetBuilder as _e, Transaction as ct, EditorState as ut } from "@codemirror/state"; | ||
import { markdown as ft, markdownLanguage as mt } from "@codemirror/lang-markdown"; | ||
import { languages as pt } from "@codemirror/language-data"; | ||
import { EditorView as q, Decoration as L, ViewPlugin as Ce, keymap as gt } from "@codemirror/view"; | ||
import { syntaxTree as le, syntaxHighlighting as kt, HighlightStyle as ht } from "@codemirror/language"; | ||
import { defaultKeymap as bt, historyKeymap as xt, indentMore as vt, indentLess as yt, history as $t } from "@codemirror/commands"; | ||
import { tags as c } from "@lezer/highlight"; | ||
const wt = "data-ink-mde-ssr-hydration-marker", _t = `[${wt}]`, Ct = () => ({}), E = { | ||
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 { tags as d } from "@lezer/highlight"; | ||
const at = "data-ink-mde-ssr-hydration-marker", lt = `[${at}]`, st = () => ({}), O = { | ||
array: "[object Array]", | ||
@@ -16,11 +16,11 @@ object: "[object Object]", | ||
window: "[object Window]" | ||
}, St = (e) => { | ||
if (Object.prototype.toString.call(e) === E.object) | ||
}, ct = (e) => { | ||
if (Object.prototype.toString.call(e) === O.object) | ||
return `[object ${e.constructor.name}]`; | ||
}, T = (e, t) => St(e) === t, Lt = (e, t) => { | ||
const n = /* @__PURE__ */ new WeakMap(), r = (o, i) => n.get(o) || (T(o, E.object) && n.set(o, !0), T(i, E.undefined)) ? o : T(o, E.array) && T(i, E.array) ? [...i] : T(o, E.object) && T(i, E.object) ? Object.keys(o).reduce((a, s) => (Object.hasOwnProperty.call(i, s) ? a[s] = r(o[s], i[s]) : a[s] = o[s], a), {}) : i; | ||
return r(e, t); | ||
}, P = (e, t) => Lt(e, t); | ||
var V = /* @__PURE__ */ ((e) => (e.Auto = "auto", e.Dark = "dark", e.Light = "light", e))(V || {}), Mt = /* @__PURE__ */ ((e) => (e.Appearance = "appearance", e.Attribution = "attribution", e.Autocomplete = "autocomplete", e.Images = "images", e.ReadOnly = "readonly", e.Spellcheck = "spellcheck", e.Vim = "vim", e))(Mt || {}), k = /* @__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))(k || {}), Y = /* @__PURE__ */ ((e) => (e.Completion = "completion", e.Default = "default", e.Grammar = "grammar", e.Language = "language", e))(Y || {}), re = /* @__PURE__ */ ((e) => (e.End = "end", e.Start = "start", e))(re || {}); | ||
const xe = () => document.createElement("div"), Se = () => window.matchMedia("(prefers-color-scheme: dark)").matches, Ht = (e) => e === V.Dark ? !0 : e === V.Light ? !1 : Se(), te = (e) => { | ||
}, P = (e, t) => ct(e) === t, dt = (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) => { | ||
const t = [ | ||
@@ -100,14 +100,16 @@ // --ink-* | ||
{ suffix: "syntax-strong-font-weight", default: "600" }, | ||
{ suffix: "syntax-url-color", default: "#aaaaaa", light: "#666666" } | ||
], n = !Ht(e.options.interface.appearance); | ||
return t.map((r) => { | ||
const o = n && r.light ? r.light : r.default; | ||
return `--ink-internal-${r.suffix}: var(--ink-${r.suffix}, ${o});`; | ||
{ suffix: "syntax-url-color", default: "#aaaaaa", light: "#666666" }, | ||
{ suffix: "toolbar-group-spacing", default: "2rem" }, | ||
{ suffix: "toolbar-item-spacing", default: "0" } | ||
], n = !ft(e.options.interface.appearance); | ||
return t.map((o) => { | ||
const r = n && o.light ? o.light : o.default; | ||
return `--ink-internal-${o.suffix}: var(--ink-${o.suffix}, ${r});`; | ||
}); | ||
}, At = (e) => [ | ||
q.theme({}, { dark: e }) | ||
], zt = (e) => e.extensions.map((t) => t.initialValue(e)), de = (e) => Promise.all( | ||
}, mt = (e) => [ | ||
Q.theme({}, { dark: e }) | ||
], pt = (e) => e.extensions.map((t) => t.initialValue(e)), ce = (e) => Promise.all( | ||
e.extensions.map((t) => t.reconfigure(e.options)) | ||
), Et = (e) => { | ||
const t = new we(); | ||
), gt = (e) => { | ||
const t = new xe(); | ||
return { | ||
@@ -118,4 +120,4 @@ compartment: t, | ||
}; | ||
}, Bt = (e) => { | ||
const t = new we(); | ||
}, kt = (e) => { | ||
const t = new xe(); | ||
return { | ||
@@ -126,12 +128,12 @@ compartment: t, | ||
}; | ||
}, jt = () => [ | ||
...Dt.map((e) => Et(e)), | ||
...Tt.map((e) => Bt(e)) | ||
], Dt = [ | ||
(e) => e.plugins.reduce((n, r) => (r.type === Y.Default && n.push(r.value), n), []), | ||
}, ht = () => [ | ||
...bt.map((e) => gt(e)), | ||
...xt.map((e) => kt(e)) | ||
], bt = [ | ||
(e) => e.plugins.reduce((n, o) => (o.type === J.Default && n.push(o.value), n), []), | ||
(e) => { | ||
const t = e.plugins.reduce((r, o) => (o.type === Y.Grammar && r.push(o.value), r), []), n = e.plugins.reduce((r, o) => (o.type === Y.Language && r.push(o.value), r), []); | ||
return ft({ | ||
base: mt, | ||
codeLanguages: [...pt, ...n], | ||
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], | ||
extensions: t | ||
@@ -141,6 +143,6 @@ }); | ||
(e) => { | ||
const t = e.interface.appearance === V.Dark, n = e.interface.appearance === V.Auto; | ||
return At(t || n && Se()); | ||
const t = e.interface.appearance === W.Dark, n = e.interface.appearance === W.Auto; | ||
return mt(t || n && $e()); | ||
} | ||
], Tt = [ | ||
], xt = [ | ||
async (e, t) => { | ||
@@ -195,3 +197,3 @@ if (e.interface.autocomplete) { | ||
} | ||
], oe = () => { | ||
], re = () => { | ||
const e = { | ||
@@ -214,3 +216,3 @@ doc: "", | ||
interface: { | ||
appearance: V.Auto, | ||
appearance: W.Auto, | ||
attribution: !0, | ||
@@ -247,11 +249,11 @@ autocomplete: !1, | ||
editor: {}, | ||
extensions: jt(), | ||
extensions: ht(), | ||
options: e, | ||
root: xe(), | ||
target: xe() | ||
root: ge(), | ||
target: ge() | ||
}; | ||
}, Vt = (e) => P(oe(), e), ce = (e, t = {}) => { | ||
const [n, r] = B(Vt({ ...t, doc: e.doc || "", options: e })); | ||
return [n, r]; | ||
}, Ot = ([e]) => { | ||
}, vt = (e) => Y(re(), e), de = (e, t = {}) => { | ||
const [n, o] = R(vt({ ...t, doc: e.doc || "", options: e })); | ||
return [n, o]; | ||
}, yt = ([e]) => { | ||
const { editor: t } = e(); | ||
@@ -262,9 +264,9 @@ t.destroy(); | ||
t.hasFocus || t.focus(); | ||
}, Le = (e) => { | ||
const t = e.map((n) => lt.fromJSON({ anchor: n.start, head: n.end })); | ||
return dt.create(t); | ||
}, Me = (e) => e.ranges.map((n) => ({ | ||
}, _e = (e) => { | ||
const t = e.map((n) => Fe.fromJSON({ anchor: n.start, head: n.end })); | ||
return Ue.create(t); | ||
}, we = (e) => e.ranges.map((n) => ({ | ||
end: n.anchor < n.head ? n.head : n.anchor, | ||
start: n.head < n.anchor ? n.head : n.anchor | ||
})), C = (e) => ({ ...{ | ||
})), A = (e) => ({ ...{ | ||
block: !1, | ||
@@ -277,4 +279,4 @@ line: !1, | ||
suffix: "" | ||
}, ...e }), Rt = { | ||
[k.Bold]: C({ | ||
}, ...e }), $t = { | ||
[x.Bold]: A({ | ||
nodes: ["StrongEmphasis"], | ||
@@ -284,3 +286,3 @@ prefix: "**", | ||
}), | ||
[k.Code]: C({ | ||
[x.Code]: A({ | ||
nodes: ["InlineCode"], | ||
@@ -290,3 +292,3 @@ prefix: "`", | ||
}), | ||
[k.CodeBlock]: C({ | ||
[x.CodeBlock]: A({ | ||
block: !0, | ||
@@ -297,3 +299,3 @@ nodes: ["FencedCode"], | ||
}), | ||
[k.Heading]: C({ | ||
[x.Heading]: A({ | ||
multiline: !0, | ||
@@ -304,3 +306,3 @@ nodes: ["ATXHeading1", "ATXHeading2", "ATXHeading3", "ATXHeading4", "ATXHeading5", "ATXHeading6"], | ||
}), | ||
[k.Image]: C({ | ||
[x.Image]: A({ | ||
nodes: ["Image"], | ||
@@ -310,3 +312,3 @@ prefix: "![](", | ||
}), | ||
[k.Italic]: C({ | ||
[x.Italic]: A({ | ||
nodes: ["Emphasis"], | ||
@@ -316,3 +318,3 @@ prefix: "*", | ||
}), | ||
[k.Link]: C({ | ||
[x.Link]: A({ | ||
nodes: ["Link"], | ||
@@ -322,3 +324,3 @@ prefix: "[](", | ||
}), | ||
[k.OrderedList]: C({ | ||
[x.OrderedList]: A({ | ||
line: !0, | ||
@@ -329,3 +331,3 @@ multiline: !0, | ||
}), | ||
[k.Quote]: C({ | ||
[x.Quote]: A({ | ||
line: !0, | ||
@@ -336,3 +338,3 @@ multiline: !0, | ||
}), | ||
[k.TaskList]: C({ | ||
[x.TaskList]: A({ | ||
line: !0, | ||
@@ -343,3 +345,3 @@ multiline: !0, | ||
}), | ||
[k.List]: C({ | ||
[x.List]: A({ | ||
line: !0, | ||
@@ -350,33 +352,33 @@ multiline: !0, | ||
}) | ||
}, It = ({ editor: e, selection: t }) => { | ||
}, _t = ({ editor: e, selection: t }) => { | ||
let n = t.start; | ||
const r = []; | ||
const o = []; | ||
for (; n <= t.end; ) { | ||
const o = e.lineBlockAt(n), i = Math.max(t.start, o.from), a = Math.min(t.end, o.to); | ||
r.push({ start: i, end: a }), n = o.to + 1; | ||
const r = e.lineBlockAt(n), i = Math.max(t.start, r.from), a = Math.min(t.end, r.to); | ||
o.push({ start: i, end: a }), n = r.to + 1; | ||
} | ||
return r; | ||
}, Nt = ({ editor: e, formatDefinition: t, selection: n }) => { | ||
return o; | ||
}, wt = ({ editor: e, formatDefinition: t, selection: n }) => { | ||
if (!e || !t) | ||
return n || { start: 0, end: 0 }; | ||
const r = n || Me(e.state.selection).pop() || { start: 0, end: 0 }; | ||
const o = n || we(e.state.selection).pop() || { start: 0, end: 0 }; | ||
if (t.block || t.line || t.multiline) { | ||
const a = e.lineBlockAt(r.start).from, s = e.lineBlockAt(r.end).to; | ||
const a = e.lineBlockAt(o.start).from, s = e.lineBlockAt(o.end).to; | ||
return { start: a, end: s }; | ||
} | ||
const o = e.state.wordAt(r.start)?.from || r.start, i = e.state.wordAt(r.end)?.to || r.end; | ||
return { start: o, end: i }; | ||
}, He = (e) => e.editor.state.sliceDoc(e.selection.start, e.selection.end), qt = (e, t, n) => Pt(e, n).find(({ type: o }) => t.nodes.includes(o.name)), Pt = (e, t) => { | ||
const r = e.state.wordAt(o.start)?.from || o.start, i = e.state.wordAt(o.end)?.to || o.end; | ||
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) => { | ||
const n = []; | ||
return le(e.state).iterate({ | ||
return se(e.state).iterate({ | ||
from: t.start, | ||
to: t.end, | ||
enter: ({ type: r, from: o, to: i }) => { | ||
n.push({ type: r, from: o, to: i }); | ||
enter: ({ type: o, from: r, to: i }) => { | ||
n.push({ type: o, from: r, to: i }); | ||
} | ||
}), n; | ||
}, ue = (e) => { | ||
const t = He(e), n = e.formatDefinition.prefix.length, r = e.formatDefinition.suffix.length * -1 || t.length, o = t.slice(n, r); | ||
return [{ from: e.selection.start, to: e.selection.end, insert: o }]; | ||
}, Wt = (e) => { | ||
const t = Ce(e), n = e.formatDefinition.prefix.length, o = e.formatDefinition.suffix.length * -1 || t.length, r = t.slice(n, o); | ||
return [{ from: e.selection.start, to: e.selection.end, insert: r }]; | ||
}, Lt = (e) => { | ||
if (e.node) { | ||
@@ -392,14 +394,14 @@ const t = e.node.from, n = e.node.to; | ||
} | ||
}, Ft = (e) => { | ||
const t = It(e), n = []; | ||
return t.forEach((r) => { | ||
const o = Ae({ ...e, selection: r }); | ||
n.push(...o); | ||
}, Mt = (e) => { | ||
const t = _t(e), n = []; | ||
return t.forEach((o) => { | ||
const r = Se({ ...e, selection: o }); | ||
n.push(...r); | ||
}), n; | ||
}, Ae = (e) => { | ||
const t = e.formatDefinition.prefixStates.length > 0, n = He(e); | ||
}, Se = (e) => { | ||
const t = e.formatDefinition.prefixStates.length > 0, n = Ce(e); | ||
if (e.node && t) { | ||
const r = e.formatDefinition.prefixStates.find((o) => n.startsWith(o)); | ||
if (r) { | ||
const o = e.formatDefinition.prefixStates.indexOf(r), i = e.formatDefinition.prefixStates[o + 1], a = n.replace(new RegExp(`^${r}`), i); | ||
const o = e.formatDefinition.prefixStates.find((r) => n.startsWith(r)); | ||
if (o) { | ||
const r = e.formatDefinition.prefixStates.indexOf(o), i = e.formatDefinition.prefixStates[r + 1], a = n.replace(new RegExp(`^${o}`), i); | ||
return [{ from: e.selection.start, to: e.selection.end, insert: a }]; | ||
@@ -410,3 +412,3 @@ } | ||
return [{ from: e.selection.start, insert: e.formatDefinition.prefix }]; | ||
}, Ut = (e) => { | ||
}, Ht = (e) => { | ||
if (e.node) { | ||
@@ -416,20 +418,20 @@ const t = e.node.from, n = e.node.to; | ||
} else { | ||
const { formatDefinition: t, selection: n } = e, r = Array.isArray(t.prefix) ? t.prefix[0] : t.prefix, o = t.suffix; | ||
const { formatDefinition: t, selection: n } = e, o = Array.isArray(t.prefix) ? t.prefix[0] : t.prefix, r = t.suffix; | ||
return [ | ||
{ from: n.start, insert: r }, | ||
{ from: n.end, insert: o } | ||
{ from: n.start, insert: o }, | ||
{ from: n.end, insert: r } | ||
]; | ||
} | ||
}, Xt = (e) => e.formatDefinition.block ? Wt(e) : e.formatDefinition.multiline ? Ft(e) : e.formatDefinition.line ? Ae(e) : Ut(e), ze = ([e], t, { selection: n } = {}) => { | ||
const { editor: r } = e(), o = Rt[t], i = Nt({ editor: r, formatDefinition: o, selection: n }), a = qt(r, o, i), d = Xt({ | ||
editor: r, | ||
formatDefinition: o, | ||
}, 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({ | ||
editor: o, | ||
formatDefinition: r, | ||
node: a, | ||
selection: i | ||
}), u = d.reduce(($, y) => { | ||
const w = y.insert.length - ((y.to || y.from) - y.from); | ||
return $ + w; | ||
}, 0), h = e().editor.state.update({ changes: d, selection: { head: i.start, anchor: i.end + u } }); | ||
e().editor.dispatch(h); | ||
}, Kt = ([e]) => { | ||
}), u = c.reduce((_, w) => { | ||
const L = w.insert.length - ((w.to || w.from) - w.from); | ||
return _ + L; | ||
}, 0), v = e().editor.state.update({ changes: c, selection: { head: i.start, anchor: i.end + u } }); | ||
e().editor.dispatch(v); | ||
}, zt = ([e]) => { | ||
const { editor: t } = e(); | ||
@@ -439,6 +441,6 @@ return t.state.sliceDoc(); | ||
const { editor: t } = e(); | ||
return Me(t.state.selection); | ||
}, Z = ([e, t], n, r, o = !1) => { | ||
return we(t.state.selection); | ||
}, ee = ([e, t], n, o, r = !1) => { | ||
const { editor: i } = e(); | ||
let a = r?.start, s = r?.end || r?.start; | ||
let a = o?.start, s = o?.end || o?.start; | ||
if (typeof a > "u") { | ||
@@ -448,25 +450,25 @@ const u = fe([e, t]).pop(); | ||
} | ||
const d = { changes: { from: a, to: s, insert: n } }; | ||
if (o) { | ||
const u = a === s ? a + n.length : a, h = a + n.length; | ||
Object.assign(d, { selection: { anchor: u, head: h } }); | ||
const c = { changes: { from: a, to: s, insert: n } }; | ||
if (r) { | ||
const u = a === s ? a + n.length : a, v = a + n.length; | ||
Object.assign(c, { selection: { anchor: u, head: v } }); | ||
} | ||
i.dispatch( | ||
i.state.update(d) | ||
i.state.update(c) | ||
); | ||
}, Qt = [ | ||
}, Bt = [ | ||
"Blockquote" | ||
], Yt = L.line({ attributes: { class: "cm-blockquote" } }), Zt = L.line({ attributes: { class: "cm-blockquote-open" } }), Gt = L.line({ attributes: { class: "cm-blockquote-close" } }), Jt = Ce.define((e) => ({ | ||
update: () => en(e) | ||
}), { decorations: (e) => e.update() }), en = (e) => { | ||
const t = new _e(), n = le(e.state); | ||
for (const r of e.visibleRanges) | ||
for (let o = r.from; o < r.to; ) { | ||
const i = e.state.doc.lineAt(o); | ||
], 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) => { | ||
const t = new ve(), n = se(e.state); | ||
for (const o of e.visibleRanges) | ||
for (let r = o.from; r < o.to; ) { | ||
const i = e.state.doc.lineAt(r); | ||
n.iterate({ | ||
enter({ type: a, from: s, to: d }) { | ||
if (a.name !== "Document" && Qt.includes(a.name)) { | ||
t.add(i.from, i.from, Yt); | ||
const u = e.state.doc.lineAt(s), h = e.state.doc.lineAt(d); | ||
return u.number === i.number && t.add(i.from, i.from, Zt), h.number === i.number && t.add(i.from, i.from, Gt), !1; | ||
enter({ type: a, from: s, to: c }) { | ||
if (a.name !== "Document" && Bt.includes(a.name)) { | ||
t.add(i.from, i.from, Et); | ||
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; | ||
} | ||
@@ -476,8 +478,8 @@ }, | ||
to: i.to | ||
}), o = i.to + 1; | ||
}), r = i.to + 1; | ||
} | ||
return t.finish(); | ||
}, tn = () => [ | ||
Jt | ||
], nn = [ | ||
}, Ot = () => [ | ||
Tt | ||
], Rt = [ | ||
"CodeBlock", | ||
@@ -487,3 +489,3 @@ "FencedCode", | ||
"CommentBlock" | ||
], O = { | ||
], F = { | ||
// Prevent spellcheck in all code blocks. The Grammarly extension might not respect these values. | ||
@@ -494,62 +496,62 @@ "data-enable-grammarly": "false", | ||
spellcheck: "false" | ||
}, rn = L.line({ attributes: { ...O, class: "cm-codeblock" } }), on = L.line({ attributes: { ...O, class: "cm-codeblock-open" } }), an = L.line({ attributes: { ...O, class: "cm-codeblock-close" } }), sn = L.mark({ attributes: { ...O, class: "cm-code" } }), ln = L.mark({ attributes: { ...O, class: "cm-code cm-code-open" } }), dn = L.mark({ attributes: { ...O, class: "cm-code cm-code-close" } }), cn = Ce.define((e) => ({ | ||
update: () => un(e) | ||
}), { decorations: (e) => e.update() }), un = (e) => { | ||
const t = new _e(), n = le(e.state); | ||
for (const r of e.visibleRanges) | ||
for (let o = r.from; o < r.to; ) { | ||
const i = e.state.doc.lineAt(o); | ||
}, 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) => { | ||
const t = new ve(), n = se(e.state); | ||
for (const o of e.visibleRanges) | ||
for (let r = o.from; r < o.to; ) { | ||
const i = e.state.doc.lineAt(r); | ||
let a; | ||
n.iterate({ | ||
enter({ type: s, from: d, to: u }) { | ||
enter({ type: s, from: c, to: u }) { | ||
if (s.name !== "Document") | ||
if (nn.includes(s.name)) { | ||
t.add(i.from, i.from, rn); | ||
const h = e.state.doc.lineAt(d), $ = e.state.doc.lineAt(u); | ||
return h.number === i.number && t.add(i.from, i.from, on), $.number === i.number && t.add(i.from, i.from, an), !1; | ||
if (Rt.includes(s.name)) { | ||
t.add(i.from, i.from, qt); | ||
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; | ||
} else | ||
s.name === "InlineCode" ? a = { from: d, to: u, innerFrom: d, innerTo: u } : s.name === "CodeMark" && (d === a.from ? (a.innerFrom = u, t.add(d, u, ln)) : u === a.to && (a.innerTo = d, t.add(a.innerFrom, a.innerTo, sn), t.add(d, u, dn))); | ||
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))); | ||
}, | ||
from: i.from, | ||
to: i.to | ||
}), o = i.to + 1; | ||
}), r = i.to + 1; | ||
} | ||
return t.finish(); | ||
}, fn = () => [ | ||
cn | ||
], mn = () => [ | ||
q.editorAttributes.of({ | ||
}, Kt = () => [ | ||
Ut | ||
], Qt = () => [ | ||
Q.editorAttributes.of({ | ||
class: "ink-mde-container" | ||
}), | ||
q.contentAttributes.of({ | ||
Q.contentAttributes.of({ | ||
class: "ink-mde-editor-content" | ||
}) | ||
// Todo: Maybe open a PR to add scrollerAttributes? | ||
], pn = () => [ | ||
...mn() | ||
], gn = [ | ||
], Yt = () => [ | ||
...Qt() | ||
], Zt = [ | ||
{ | ||
key: "Tab", | ||
run: ({ state: e, dispatch: t }) => e.selection.ranges.some((n) => !n.empty) ? vt({ state: e, dispatch: t }) : (t( | ||
run: ({ state: e, dispatch: t }) => e.selection.ranges.some((n) => !n.empty) ? ot({ state: e, dispatch: t }) : (t( | ||
e.update(e.replaceSelection(" "), { | ||
scrollIntoView: !0, | ||
annotations: ct.userEvent.of("input") | ||
annotations: Xe.userEvent.of("input") | ||
}) | ||
), !0), | ||
shift: yt | ||
shift: rt | ||
} | ||
], kn = () => gt.of([ | ||
...gn, | ||
...bt, | ||
...xt | ||
]), hn = () => q.lineWrapping, bn = () => [ | ||
kt( | ||
ht.define([ | ||
], Gt = () => Ge.of([ | ||
...Zt, | ||
...tt, | ||
...nt | ||
]), Jt = () => Q.lineWrapping, en = () => [ | ||
Je( | ||
et.define([ | ||
// ordered by lowest to highest precedence | ||
{ | ||
tag: c.atom, | ||
tag: d.atom, | ||
color: "var(--ink-internal-syntax-atom-color)" | ||
}, | ||
{ | ||
tag: c.meta, | ||
tag: d.meta, | ||
color: "var(--ink-internal-syntax-meta-color)" | ||
@@ -559,3 +561,3 @@ }, | ||
{ | ||
tag: c.emphasis, | ||
tag: d.emphasis, | ||
color: "var(--ink-internal-syntax-emphasis-color)", | ||
@@ -565,3 +567,3 @@ fontStyle: "var(--ink-internal-syntax-emphasis-font-style)" | ||
{ | ||
tag: c.strong, | ||
tag: d.strong, | ||
color: "var(--ink-internal-syntax-strong-color)", | ||
@@ -571,3 +573,3 @@ fontWeight: "var(--ink-internal-syntax-strong-font-weight)" | ||
{ | ||
tag: c.strikethrough, | ||
tag: d.strikethrough, | ||
color: "var(--ink-internal-syntax-strikethrough-color)", | ||
@@ -578,3 +580,3 @@ textDecoration: "var(--ink-internal-syntax-strikethrough-text-decoration)" | ||
{ | ||
tag: c.comment, | ||
tag: d.comment, | ||
color: "var(--ink-internal-syntax-comment-color)", | ||
@@ -585,3 +587,3 @@ fontStyle: "var(--ink-internal-syntax-comment-font-style)" | ||
{ | ||
tag: c.monospace, | ||
tag: d.monospace, | ||
color: "var(--ink-internal-syntax-code-color)", | ||
@@ -592,31 +594,31 @@ fontFamily: "var(--ink-internal-syntax-code-font-family)" | ||
{ | ||
tag: c.name, | ||
tag: d.name, | ||
color: "var(--ink-internal-syntax-name-color)" | ||
}, | ||
{ | ||
tag: c.labelName, | ||
tag: d.labelName, | ||
color: "var(--ink-internal-syntax-name-label-color)" | ||
}, | ||
{ | ||
tag: c.propertyName, | ||
tag: d.propertyName, | ||
color: "var(--ink-internal-syntax-name-property-color)" | ||
}, | ||
{ | ||
tag: c.definition(c.propertyName), | ||
tag: d.definition(d.propertyName), | ||
color: "var(--ink-internal-syntax-name-property-definition-color)" | ||
}, | ||
{ | ||
tag: c.variableName, | ||
tag: d.variableName, | ||
color: "var(--ink-internal-syntax-name-variable-color)" | ||
}, | ||
{ | ||
tag: c.definition(c.variableName), | ||
tag: d.definition(d.variableName), | ||
color: "var(--ink-internal-syntax-name-variable-definition-color)" | ||
}, | ||
{ | ||
tag: c.local(c.variableName), | ||
tag: d.local(d.variableName), | ||
color: "var(--ink-internal-syntax-name-variable-local-color)" | ||
}, | ||
{ | ||
tag: c.special(c.variableName), | ||
tag: d.special(d.variableName), | ||
color: "var(--ink-internal-syntax-name-variable-special-color)" | ||
@@ -626,3 +628,3 @@ }, | ||
{ | ||
tag: c.heading, | ||
tag: d.heading, | ||
color: "var(--ink-internal-syntax-heading-color)", | ||
@@ -632,3 +634,3 @@ fontWeight: "var(--ink-internal-syntax-heading-font-weight)" | ||
{ | ||
tag: c.heading1, | ||
tag: d.heading1, | ||
color: "var(--ink-internal-syntax-heading1-color)", | ||
@@ -639,3 +641,3 @@ fontSize: "var(--ink-internal-syntax-heading1-font-size)", | ||
{ | ||
tag: c.heading2, | ||
tag: d.heading2, | ||
color: "var(--ink-internal-syntax-heading2-color)", | ||
@@ -646,3 +648,3 @@ fontSize: "var(--ink-internal-syntax-heading2-font-size)", | ||
{ | ||
tag: c.heading3, | ||
tag: d.heading3, | ||
color: "var(--ink-internal-syntax-heading3-color)", | ||
@@ -653,3 +655,3 @@ fontSize: "var(--ink-internal-syntax-heading3-font-size)", | ||
{ | ||
tag: c.heading4, | ||
tag: d.heading4, | ||
color: "var(--ink-internal-syntax-heading4-color)", | ||
@@ -660,3 +662,3 @@ fontSize: "var(--ink-internal-syntax-heading4-font-size)", | ||
{ | ||
tag: c.heading5, | ||
tag: d.heading5, | ||
color: "var(--ink-internal-syntax-heading5-color)", | ||
@@ -667,3 +669,3 @@ fontSize: "var(--ink-internal-syntax-heading5-font-size)", | ||
{ | ||
tag: c.heading6, | ||
tag: d.heading6, | ||
color: "var(--ink-internal-syntax-heading6-color)", | ||
@@ -675,23 +677,23 @@ fontSize: "var(--ink-internal-syntax-heading6-font-size)", | ||
{ | ||
tag: c.keyword, | ||
tag: d.keyword, | ||
color: "var(--ink-internal-syntax-keyword-color)" | ||
}, | ||
{ | ||
tag: c.number, | ||
tag: d.number, | ||
color: "var(--ink-internal-syntax-number-color)" | ||
}, | ||
{ | ||
tag: c.operator, | ||
tag: d.operator, | ||
color: "var(--ink-internal-syntax-operator-color)" | ||
}, | ||
{ | ||
tag: c.punctuation, | ||
tag: d.punctuation, | ||
color: "var(--ink-internal-syntax-punctuation-color)" | ||
}, | ||
{ | ||
tag: c.link, | ||
tag: d.link, | ||
color: "var(--ink-internal-syntax-link-color)" | ||
}, | ||
{ | ||
tag: c.url, | ||
tag: d.url, | ||
color: "var(--ink-internal-syntax-url-color)" | ||
@@ -701,7 +703,7 @@ }, | ||
{ | ||
tag: c.string, | ||
tag: d.string, | ||
color: "var(--ink-internal-syntax-string-color)" | ||
}, | ||
{ | ||
tag: c.special(c.string), | ||
tag: d.special(d.string), | ||
color: "var(--ink-internal-syntax-string-special-color)" | ||
@@ -711,3 +713,3 @@ }, | ||
{ | ||
tag: c.processingInstruction, | ||
tag: d.processingInstruction, | ||
color: "var(--ink-internal-syntax-processing-instruction-color)" | ||
@@ -717,46 +719,46 @@ } | ||
) | ||
], xn = (e) => { | ||
], tn = (e) => { | ||
if (e.length > 0) | ||
return Le(e); | ||
}, Ee = (e) => ut.create({ | ||
return _e(e); | ||
}, Me = (e) => Ke.create({ | ||
doc: e.options.doc, | ||
selection: xn(e.options.selections), | ||
selection: tn(e.options.selections), | ||
extensions: [ | ||
tn(), | ||
fn(), | ||
$t(), | ||
pn(), | ||
kn(), | ||
hn(), | ||
bn(), | ||
...zt(e) | ||
Ot(), | ||
Kt(), | ||
it(), | ||
Yt(), | ||
Gt(), | ||
Jt(), | ||
en(), | ||
...pt(e) | ||
] | ||
}), vn = ([e, t], n) => { | ||
t(P(e(), { options: { doc: n } })), e().editor.setState(Ee(e())); | ||
}, yn = ([e]) => e().options, $n = async ([e, t], n) => { | ||
const r = t(P(e(), { options: n })), o = await de(r); | ||
r.editor.dispatch({ effects: o }); | ||
}, Be = (e, t = {}) => { | ||
}), nn = ([e, t], n) => { | ||
t(Y(e(), { options: { doc: n } })), e().editor.setState(Me(e())); | ||
}, on = ([e]) => e().options, rn = async ([e, t], n) => { | ||
const o = t(Y(e(), { options: n })), r = await ce(o); | ||
o.editor.dispatch({ effects: r }); | ||
}, He = (e, t = {}) => { | ||
if (t.selections) | ||
return je(e, t.selections); | ||
return Ae(e, t.selections); | ||
if (t.selection) | ||
return ae(e, t.selection); | ||
if (t.at) | ||
return wn(e, t.at); | ||
}, wn = (e, t) => { | ||
return an(e, t.at); | ||
}, an = (e, t) => { | ||
const [n] = e; | ||
if (t === re.Start) | ||
if (t === oe.Start) | ||
return ae(e, { start: 0, end: 0 }); | ||
if (t === re.End) { | ||
const r = n().editor.state.doc.length; | ||
return ae(e, { start: r, end: r }); | ||
if (t === oe.End) { | ||
const o = n().editor.state.doc.length; | ||
return ae(e, { start: o, end: o }); | ||
} | ||
}, je = ([e], t) => { | ||
}, Ae = ([e], t) => { | ||
const { editor: n } = e(); | ||
n.dispatch( | ||
n.state.update({ | ||
selection: Le(t) | ||
selection: _e(t) | ||
}) | ||
); | ||
}, ae = (e, t) => je(e, [t]), _n = ([e], t) => { | ||
}, ae = (e, t) => Ae(e, [t]), ln = ([e], t) => { | ||
const { editor: n } = e(); | ||
@@ -772,120 +774,120 @@ n.dispatch( | ||
); | ||
}, Cn = ([e, t], { after: n, before: r, selection: o }) => { | ||
const { editor: i } = e(), a = o || fe([e, t]).pop() || { start: 0, end: 0 }, s = i.state.sliceDoc(a.start, a.end); | ||
Z([e, t], `${r}${s}${n}`, a), Be([e, t], { selections: [{ start: a.start + r.length, end: a.end + r.length }] }); | ||
}, De = (e) => ({ | ||
destroy: Ot.bind(void 0, e), | ||
}, sn = ([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), | ||
focus: ie.bind(void 0, e), | ||
format: ze.bind(void 0, e), | ||
getDoc: Kt.bind(void 0, e), | ||
insert: Z.bind(void 0, e), | ||
load: vn.bind(void 0, e), | ||
options: yn.bind(void 0, e), | ||
reconfigure: $n.bind(void 0, e), | ||
select: Be.bind(void 0, e), | ||
format: Le.bind(void 0, e), | ||
getDoc: zt.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), | ||
select: He.bind(void 0, e), | ||
selections: fe.bind(void 0, e), | ||
update: _n.bind(void 0, e), | ||
wrap: Cn.bind(void 0, e) | ||
}), Sn = `.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} | ||
`, Ln = /* @__PURE__ */ m("<span>uploading files...</span>", 2), Mn = /* @__PURE__ */ m('<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), Hn = /* @__PURE__ */ m('<img class="ink-drop-zone-file-preview-image">', 1), An = /* @__PURE__ */ m("<span>drop files here</span>", 2), zn = () => { | ||
const [e, t] = B(0), [n, r] = B([]), [o, i] = B(!1), [a, s] = B(!1), [d, u] = R(), h = () => { | ||
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 = () => { | ||
const [e, t] = R(0), [n, o] = R([]), [r, i] = R(!1), [a, s] = R(!1), [c, u] = U(), v = () => { | ||
s(!1); | ||
}, $ = (g) => { | ||
if (d().options.files.dragAndDrop) { | ||
g.preventDefault(), g.stopPropagation(); | ||
const v = g.dataTransfer; | ||
v?.files ? W(v.files) : (t(0), s(!1), r([])); | ||
}, _ = (h) => { | ||
if (c().options.files.dragAndDrop) { | ||
h.preventDefault(), h.stopPropagation(); | ||
const y = h.dataTransfer; | ||
y?.files ? X(y.files) : (t(0), s(!1), o([])); | ||
} | ||
}, y = (g) => { | ||
d().options.files.dragAndDrop && (g.preventDefault(), t(e() + 1), s(!0)); | ||
}, w = (g) => { | ||
d().options.files.dragAndDrop && (g.preventDefault(), t(e() - 1), e() === 0 && s(!1)); | ||
}, M = (g) => { | ||
d().options.files.dragAndDrop && (g.preventDefault(), s(!0)); | ||
}, A = (g) => { | ||
d().options.files.dragAndDrop && (g.preventDefault(), t(0), s(!1)); | ||
}, j = (g) => { | ||
if (d().options.files.clipboard) { | ||
g.preventDefault(); | ||
const v = g.clipboardData; | ||
v?.files && v.files.length > 0 && W(v.files); | ||
}, w = (h) => { | ||
c().options.files.dragAndDrop && (h.preventDefault(), t(e() + 1), s(!0)); | ||
}, L = (h) => { | ||
c().options.files.dragAndDrop && (h.preventDefault(), t(e() - 1), e() === 0 && s(!1)); | ||
}, E = (h) => { | ||
c().options.files.dragAndDrop && (h.preventDefault(), s(!0)); | ||
}, q = (h) => { | ||
c().options.files.dragAndDrop && (h.preventDefault(), t(0), s(!1)); | ||
}, I = (h) => { | ||
if (c().options.files.clipboard) { | ||
h.preventDefault(); | ||
const y = h.clipboardData; | ||
y?.files && y.files.length > 0 && X(y.files); | ||
} | ||
}, W = (g) => { | ||
Array.from(g).forEach((v) => { | ||
r([...n(), v]); | ||
}), i(!0), s(!0), Promise.resolve(d().options.files.handler(g)).then((v) => { | ||
if (d().options.files.injectMarkup && v) { | ||
const S = `![](${v})`; | ||
Z([d, u], S); | ||
}, X = (h) => { | ||
Array.from(h).forEach((y) => { | ||
o([...n(), y]); | ||
}), i(!0), s(!0), Promise.resolve(c().options.files.handler(h)).then((y) => { | ||
if (c().options.files.injectMarkup && y) { | ||
const K = `![](${y})`; | ||
ee([c, u], K); | ||
} | ||
}).finally(() => { | ||
t(0), i(!1), s(!1), r([]); | ||
t(0), i(!1), s(!1), o([]); | ||
}); | ||
}; | ||
return $e(() => { | ||
document.addEventListener("dragenter", y), document.addEventListener("dragleave", w), document.addEventListener("dragover", M), document.addEventListener("drop", A), d().root.addEventListener("paste", j); | ||
}), rt(() => { | ||
document.removeEventListener("dragenter", y), document.removeEventListener("dragleave", w), document.removeEventListener("dragover", M), document.removeEventListener("drop", A), d().root.removeEventListener("paste", j); | ||
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); | ||
}), (() => { | ||
const g = f(Mn), v = g.firstChild, S = v.nextSibling, D = S.firstChild, I = D.firstChild, G = I.nextSibling, [J, F] = b(G.nextSibling), ee = D.nextSibling; | ||
return v.textContent = Sn, D.addEventListener("drop", $), p(I, l(ot, { | ||
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, { | ||
get each() { | ||
return n().slice(0, 8); | ||
}, | ||
children: (U) => (() => { | ||
const N = f(Hn); | ||
return ne((z) => { | ||
const H = U.name, X = URL.createObjectURL(U); | ||
return H !== z._v$ && be(N, "alt", z._v$ = H), X !== z._v$2 && be(N, "src", z._v$2 = X), z; | ||
children: ($) => (() => { | ||
const H = f(fn); | ||
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; | ||
}, { | ||
_v$: void 0, | ||
_v$2: void 0 | ||
}), N; | ||
}), H; | ||
})() | ||
})), p(D, l(x, { | ||
})), m(N, l(b, { | ||
get when() { | ||
return o(); | ||
return r(); | ||
}, | ||
get fallback() { | ||
return f(An); | ||
return f(mn); | ||
}, | ||
get children() { | ||
return f(Ln); | ||
return f(dn); | ||
} | ||
}), J, F), ee.$$click = h, ne(() => g.classList.toggle("visible", !!a())), se(), g; | ||
}), C, D), T.$$click = v, ne(() => h.classList.toggle("visible", !!a())), le(), h; | ||
})(); | ||
}; | ||
ve(["click"]); | ||
const En = ([e, t]) => { | ||
const n = new q({ | ||
dispatch: (r) => { | ||
const { options: o } = e(), i = r.newDoc.toString(); | ||
o.hooks.beforeUpdate(i), n.update([r]), r.docChanged && (t({ ...e(), doc: i }), o.hooks.afterUpdate(i)); | ||
ke(["click"]); | ||
const gn = ([e, t]) => { | ||
const n = new Q({ | ||
dispatch: (o) => { | ||
const { options: r } = e(), i = o.newDoc.toString(); | ||
r.hooks.beforeUpdate(i), n.update([o]), o.docChanged && (t({ ...e(), doc: i }), r.hooks.afterUpdate(i)); | ||
}, | ||
state: Ee(e()) | ||
state: Me(e()) | ||
}); | ||
return n; | ||
}, Bn = () => { | ||
const [e, t] = R(), n = En([e, t]); | ||
return t(P(e(), { | ||
}, kn = () => { | ||
const [e, t] = U(), n = gn([e, t]); | ||
return t(Y(e(), { | ||
editor: n | ||
})), de(e()).then((r) => { | ||
})), ce(e()).then((o) => { | ||
n.dispatch({ | ||
effects: r | ||
effects: o | ||
}); | ||
}), n.dom; | ||
}, jn = /* @__PURE__ */ m('<button class="ink-button" type="button"></button>', 2), _ = (e) => (() => { | ||
const t = f(jn); | ||
return t.$$click = (n) => e.onclick(n), p(t, () => e.children), se(), t; | ||
}, hn = /* @__PURE__ */ g('<button class="ink-button" type="button"></button>', 2), M = (e) => (() => { | ||
const t = f(hn); | ||
return t.$$click = (n) => e.onclick(n), m(t, () => e.children), le(), t; | ||
})(); | ||
ve(["click"]); | ||
const Dn = `.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:2rem}.ink-mde .ink-mde-toolbar-group{display:flex}.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%} | ||
`, Tn = /* @__PURE__ */ m('<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__ */ m('<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), On = /* @__PURE__ */ m('<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), Rn = /* @__PURE__ */ m('<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), In = /* @__PURE__ */ m('<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), Nn = /* @__PURE__ */ m('<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), qn = /* @__PURE__ */ m('<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), Pn = /* @__PURE__ */ m('<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), Wn = /* @__PURE__ */ m('<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), Fn = /* @__PURE__ */ m('<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), Un = /* @__PURE__ */ m('<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), Xn = /* @__PURE__ */ m('<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), Kn = /* @__PURE__ */ m('<input type="file">', 1), Qn = /* @__PURE__ */ m('<div class="ink-mde-toolbar"><style></style><div class="ink-mde-container"><div class="ink-mde-toolbar-group"><!#><!/><!#><!/><!#><!/></div><div class="ink-mde-toolbar-group"><!#><!/><!#><!/><!#><!/></div><div class="ink-mde-toolbar-group"><!#><!/><!#><!/><!#><!/></div><div class="ink-mde-toolbar-group"><!#><!/><!#><!/><!#><!/></div></div></div>', 38), Yn = () => { | ||
const [e, t] = R(), [n, r] = B(), o = (s) => { | ||
ze([e, t], s), ie([e, 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 [e, t] = U(), [n, o] = R(), r = (s) => { | ||
Le([e, t], s), ie([e, t]); | ||
}, i = (s) => { | ||
const d = s.target; | ||
d?.files && Promise.resolve(e().options.files.handler(d.files)).then((u) => { | ||
const h = `![](${u})`; | ||
Z([e, t], h), ie([e, t]); | ||
const c = s.target; | ||
c?.files && Promise.resolve(e().options.files.handler(c.files)).then((u) => { | ||
const v = `![](${u})`; | ||
ee([e, t], v), ie([e, t]); | ||
}); | ||
@@ -896,166 +898,198 @@ }, a = () => { | ||
return (() => { | ||
const s = f(Qn), d = s.firstChild, u = d.nextSibling, h = u.firstChild, $ = h.firstChild, [y, w] = b($.nextSibling), M = y.nextSibling, [A, j] = b(M.nextSibling), W = A.nextSibling, [g, v] = b(W.nextSibling), S = h.nextSibling, D = S.firstChild, [I, G] = b(D.nextSibling), J = I.nextSibling, [F, ee] = b(J.nextSibling), U = F.nextSibling, [N, z] = b(U.nextSibling), H = S.nextSibling, X = H.firstChild, [pe, Re] = b(X.nextSibling), Ie = pe.nextSibling, [ge, Ne] = b(Ie.nextSibling), qe = ge.nextSibling, [Pe, We] = b(qe.nextSibling), K = H.nextSibling, Fe = K.firstChild, [ke, Ue] = b(Fe.nextSibling), Xe = ke.nextSibling, [he, Ke] = b(Xe.nextSibling), Qe = he.nextSibling, [Ye, Ze] = b(Qe.nextSibling); | ||
return d.textContent = Dn, p(h, l(x, { | ||
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, { | ||
get when() { | ||
return e().options.toolbar.heading; | ||
return e().options.toolbar.heading || e().options.toolbar.bold || e().options.toolbar.italic; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Heading), | ||
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, { | ||
get when() { | ||
return e().options.toolbar.heading; | ||
}, | ||
get children() { | ||
return f(Tn); | ||
return l(M, { | ||
onclick: () => r(x.Heading), | ||
get children() { | ||
return f(xn); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), y, w), p(h, l(x, { | ||
get when() { | ||
return e().options.toolbar.bold; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Bold), | ||
}), C, D), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.bold; | ||
}, | ||
get children() { | ||
return f(Vn); | ||
return l(M, { | ||
onclick: () => r(x.Bold), | ||
get children() { | ||
return f(vn); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), A, j), p(h, l(x, { | ||
get when() { | ||
return e().options.toolbar.italic; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Italic), | ||
}), $, H), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.italic; | ||
}, | ||
get children() { | ||
return f(On); | ||
return l(M, { | ||
onclick: () => r(x.Italic), | ||
get children() { | ||
return f(yn); | ||
} | ||
}); | ||
} | ||
}); | ||
}), z, B), p; | ||
} | ||
}), g, v), p(S, l(x, { | ||
}), _, w), m(u, l(b, { | ||
get when() { | ||
return e().options.toolbar.quote; | ||
return e().options.toolbar.quote || e().options.toolbar.codeBlock || e().options.toolbar.code; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Quote), | ||
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, { | ||
get when() { | ||
return e().options.toolbar.quote; | ||
}, | ||
get children() { | ||
return f(Rn); | ||
return l(M, { | ||
onclick: () => r(x.Quote), | ||
get children() { | ||
return f($n); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), I, G), p(S, l(x, { | ||
get when() { | ||
return e().options.toolbar.codeBlock; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.CodeBlock), | ||
}), C, D), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.codeBlock; | ||
}, | ||
get children() { | ||
return f(In); | ||
return l(M, { | ||
onclick: () => r(x.CodeBlock), | ||
get children() { | ||
return f(_n); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), F, ee), p(S, l(x, { | ||
get when() { | ||
return e().options.toolbar.code; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Code), | ||
}), $, H), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.code; | ||
}, | ||
get children() { | ||
return f(Nn); | ||
return l(M, { | ||
onclick: () => r(x.Code), | ||
get children() { | ||
return f(wn); | ||
} | ||
}); | ||
} | ||
}); | ||
}), z, B), p; | ||
} | ||
}), N, z), p(H, l(x, { | ||
}), E, q), m(u, l(b, { | ||
get when() { | ||
return e().options.toolbar.list; | ||
return e().options.toolbar.list || e().options.toolbar.orderedList || e().options.toolbar.taskList; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.List), | ||
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, { | ||
get when() { | ||
return e().options.toolbar.list; | ||
}, | ||
get children() { | ||
return f(qn); | ||
return l(M, { | ||
onclick: () => r(x.List), | ||
get children() { | ||
return f(Cn); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), pe, Re), p(H, l(x, { | ||
get when() { | ||
return e().options.toolbar.orderedList; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.OrderedList), | ||
}), C, D), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.orderedList; | ||
}, | ||
get children() { | ||
return f(Pn); | ||
return l(M, { | ||
onclick: () => r(x.OrderedList), | ||
get children() { | ||
return f(Sn); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), ge, Ne), p(H, l(x, { | ||
get when() { | ||
return e().options.toolbar.taskList; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.TaskList), | ||
}), $, H), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.taskList; | ||
}, | ||
get children() { | ||
return f(Wn); | ||
return l(M, { | ||
onclick: () => r(x.TaskList), | ||
get children() { | ||
return f(Ln); | ||
} | ||
}); | ||
} | ||
}); | ||
}), z, B), p; | ||
} | ||
}), Pe, We), p(K, l(x, { | ||
}), X, h), m(u, l(b, { | ||
get when() { | ||
return e().options.toolbar.link; | ||
return e().options.toolbar.link || e().options.toolbar.image || e().options.toolbar.upload; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Link), | ||
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, { | ||
get when() { | ||
return e().options.toolbar.link; | ||
}, | ||
get children() { | ||
return f(Fn); | ||
return l(M, { | ||
onclick: () => r(x.Link), | ||
get children() { | ||
return f(Mn); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), ke, Ue), p(K, l(x, { | ||
get when() { | ||
return e().options.toolbar.image; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: () => o(k.Image), | ||
}), C, D), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.image; | ||
}, | ||
get children() { | ||
return f(Un); | ||
return l(M, { | ||
onclick: () => r(x.Image), | ||
get children() { | ||
return f(Hn); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}), he, Ke), p(K, l(x, { | ||
get when() { | ||
return e().options.toolbar.upload; | ||
}, | ||
get children() { | ||
return l(_, { | ||
onclick: a, | ||
}), $, H), m(p, l(b, { | ||
get when() { | ||
return e().options.toolbar.upload; | ||
}, | ||
get children() { | ||
return [f(Xn), (() => { | ||
const Q = f(Kn); | ||
return ye(r, Q), Q.addEventListener("change", i), Q.style.setProperty("display", "none"), Q; | ||
})()]; | ||
return l(M, { | ||
onclick: a, | ||
get children() { | ||
return [f(An), (() => { | ||
const Z = f(zn); | ||
return he(o, Z), Z.addEventListener("change", i), Z.style.setProperty("display", "none"), Z; | ||
})()]; | ||
} | ||
}); | ||
} | ||
}); | ||
}), z, B), p; | ||
} | ||
}), Ye, Ze), s; | ||
}), K, N), s; | ||
})(); | ||
}, me = 225, Zn = (e, t = me) => { | ||
const n = er(e, t), r = tr(e), o = Jn(e), i = Gn(e); | ||
return [n, r, o, i].join(" | "); | ||
}, Gn = (e) => `${nr(e)} chars`, Jn = (e) => `${rr(e)} lines`, er = (e, t = me) => { | ||
const n = or(e, t), r = Math.floor(n), o = Math.floor(n % 1 * 60); | ||
return r === 0 ? `${o}s read` : `${r}m ${o}s to read`; | ||
}, tr = (e) => `${Te(e)} words`, nr = (e) => e.length, rr = (e) => e.split(/\n/).length, or = (e, t = me) => Te(e) / t, Te = (e) => { | ||
}, me = 225, jn = (e, t = me) => { | ||
const n = Vn(e, t), o = On(e), r = Tn(e), i = Dn(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); | ||
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) => { | ||
const t = e.replace(/[']/g, "").replace(/[^\w\d]+/g, " ").trim(); | ||
return t ? t.split(/\s+/).length : 0; | ||
}, ir = /* @__PURE__ */ m('<div class="ink-mde-readability"><span></span></div>', 4), ar = /* @__PURE__ */ m("<span> |</span>", 2), sr = /* @__PURE__ */ m('<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), lr = /* @__PURE__ */ m('<div class="ink-mde-details"><div class="ink-mde-container"><div class="ink-mde-details-content"><!#><!/><!#><!/><!#><!/></div></div></div>', 12), dr = () => { | ||
const [e] = R(); | ||
}, 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 = () => { | ||
const [e] = U(); | ||
return (() => { | ||
const t = f(lr), n = t.firstChild, r = n.firstChild, o = r.firstChild, [i, a] = b(o.nextSibling), s = i.nextSibling, [d, u] = b(s.nextSibling), h = d.nextSibling, [$, y] = b(h.nextSibling); | ||
return p(r, l(x, { | ||
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); | ||
return m(o, l(b, { | ||
get when() { | ||
@@ -1065,13 +1099,13 @@ return e().options.readability; | ||
get children() { | ||
const w = f(ir), M = w.firstChild; | ||
return p(M, () => Zn(e().doc)), w; | ||
const L = f(Nn), E = L.firstChild; | ||
return m(E, () => jn(e().doc)), L; | ||
} | ||
}), i, a), p(r, l(x, { | ||
}), i, a), m(o, l(b, { | ||
get when() { | ||
return Ge(() => !!e().options.readability)() && e().options.interface.attribution; | ||
return De(() => !!e().options.readability)() && e().options.interface.attribution; | ||
}, | ||
get children() { | ||
return f(ar); | ||
return f(Pn); | ||
} | ||
}), d, u), p(r, l(x, { | ||
}), c, u), m(o, l(b, { | ||
get when() { | ||
@@ -1081,13 +1115,13 @@ return e().options.interface.attribution; | ||
get children() { | ||
return f(sr); | ||
return f(Wn); | ||
} | ||
}), $, y), t; | ||
}), _, w), t; | ||
})(); | ||
}, cr = `.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)} | ||
`, ur = /* @__PURE__ */ m("<style> </style>", 2), fr = () => { | ||
const [e] = R(), [t, n] = B(te(e())); | ||
return it(() => { | ||
}, 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 = () => { | ||
const [e] = U(), [t, n] = R(te(e())); | ||
return Ne(() => { | ||
n(te(e())); | ||
}), $e(() => { | ||
const r = window.matchMedia("(prefers-color-scheme: dark)"), o = (i) => { | ||
}), be(() => { | ||
const o = window.matchMedia("(prefers-color-scheme: dark)"), r = (i) => { | ||
const { | ||
@@ -1097,26 +1131,26 @@ editor: a, | ||
} = e(); | ||
s.isConnected ? de(e()).then((d) => { | ||
s.isConnected ? ce(e()).then((c) => { | ||
a.dispatch({ | ||
effects: d | ||
effects: c | ||
}), n(te(e())); | ||
}) : r.removeEventListener("change", o); | ||
}) : o.removeEventListener("change", r); | ||
}; | ||
r.addEventListener("change", o); | ||
o.addEventListener("change", r); | ||
}), (() => { | ||
const r = f(ur), o = r.firstChild; | ||
return ne(() => o.data = `.ink { | ||
const o = f(Kn), r = o.firstChild; | ||
return ne(() => r.data = `.ink { | ||
${t().join(` | ||
`)} | ||
} | ||
${cr}`), r; | ||
${Xn}`), o; | ||
})(); | ||
}, mr = /* @__PURE__ */ m('<div class="ink ink-mde"><!#><!/><!#><!/><!#><!/><div class="ink-mde-editor"></div><!#><!/></div>', 12), pr = () => { | ||
const [e, t] = R(), n = (r) => { | ||
t(P(e(), { | ||
root: r | ||
}, Yn = /* @__PURE__ */ g('<div class="ink ink-mde"><!#><!/><!#><!/><!#><!/><div class="ink-mde-editor"></div><!#><!/></div>', 12), Zn = () => { | ||
const [e, t] = U(), n = (o) => { | ||
t(Y(e(), { | ||
root: o | ||
})); | ||
}; | ||
return (() => { | ||
const r = f(mr), o = r.firstChild, [i, a] = b(o.nextSibling), s = i.nextSibling, [d, u] = b(s.nextSibling), h = d.nextSibling, [$, y] = b(h.nextSibling), w = $.nextSibling, M = w.nextSibling, [A, j] = b(M.nextSibling); | ||
return ye(n, r), Je(r, et(Ct), !1, !0), p(r, l(fr, {}), i, a), p(r, l(x, { | ||
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, { | ||
get when() { | ||
@@ -1126,5 +1160,5 @@ return e().options.files.clipboard || e().options.files.dragAndDrop; | ||
get children() { | ||
return l(zn, {}); | ||
return l(pn, {}); | ||
} | ||
}), d, u), p(r, l(x, { | ||
}), c, u), m(o, l(b, { | ||
get when() { | ||
@@ -1134,5 +1168,5 @@ return e().options.interface.toolbar; | ||
get children() { | ||
return l(Yn, {}); | ||
return l(En, {}); | ||
} | ||
}), $, y), p(w, l(Bn, {})), p(r, l(x, { | ||
}), _, w), m(L, l(kn, {})), m(o, l(b, { | ||
get when() { | ||
@@ -1142,9 +1176,9 @@ return e().options.readability || e().options.interface.attribution; | ||
get children() { | ||
return l(dr, { | ||
return l(Un, { | ||
store: [e, t] | ||
}); | ||
} | ||
}), A, j), se(), r; | ||
}), q, I), le(), o; | ||
})(); | ||
}, Ve = at([() => oe(), (e) => typeof e == "function" ? e(oe()) : e]), gr = (e) => l(Ve.Provider, { | ||
}, Ee = Pe([() => re(), (e) => typeof e == "function" ? e(re()) : e]), Gn = (e) => l(Ee.Provider, { | ||
get value() { | ||
@@ -1156,3 +1190,3 @@ return e.store; | ||
} | ||
}), R = () => st(Ve), Oe = (e) => l(gr, { | ||
}), U = () => We(Ee), je = (e) => l(Gn, { | ||
get store() { | ||
@@ -1162,3 +1196,3 @@ return e.store; | ||
get children() { | ||
return l(pr, { | ||
return l(Zn, { | ||
get store() { | ||
@@ -1169,13 +1203,13 @@ return e.store; | ||
} | ||
}), Mr = (e) => e, kr = (e, t = {}) => { | ||
const n = ce(t); | ||
return br(), tt(() => l(Oe, { | ||
}), fo = (e) => e, Jn = (e, t = {}) => { | ||
const n = de(t); | ||
return to(), Oe(() => l(je, { | ||
store: n | ||
}), e), De(n); | ||
}, Hr = (e, t = {}) => e.querySelector(_t) ? kr(e, t) : hr(e, t), hr = (e, t = {}) => { | ||
const n = ce(t); | ||
return nt(() => l(Oe, { | ||
}), e), ze(n); | ||
}, mo = (e, t = {}) => e.querySelector(lt) ? Jn(e, t) : eo(e, t), eo = (e, t = {}) => { | ||
const n = de(t); | ||
return Re(() => l(je, { | ||
store: n | ||
}), e), De(n); | ||
}, Ar = (e = {}) => (ce(e), ""), br = () => { | ||
}), e), ze(n); | ||
}, po = (e = {}) => (de(e), ""), to = () => { | ||
let e, t; | ||
@@ -1186,30 +1220,30 @@ e = window._$HY || (window._$HY = { | ||
r: {} | ||
}), t = (n) => n && n.hasAttribute && (n.hasAttribute("data-hk") ? n : t(n.host && n.host instanceof Node ? n.host : n.parentNode)), ["click", "input"].forEach((n) => document.addEventListener(n, (r) => { | ||
let o = r.composedPath && r.composedPath()[0] || r.target, i = t(o); | ||
i && !e.completed.has(i) && e.events.push([i, r]); | ||
})), e.init = (n, r) => { | ||
e.r[n] = [new Promise((o, i) => r = o), r]; | ||
}, e.set = (n, r, o) => { | ||
(o = e.r[n]) && o[1](r), e.r[n] = [r]; | ||
}), t = (n) => n && n.hasAttribute && (n.hasAttribute("data-hk") ? n : t(n.host && n.host instanceof Node ? n.host : n.parentNode)), ["click", "input"].forEach((n) => document.addEventListener(n, (o) => { | ||
let r = o.composedPath && o.composedPath()[0] || o.target, i = t(r); | ||
i && !e.completed.has(i) && e.events.push([i, o]); | ||
})), e.init = (n, o) => { | ||
e.r[n] = [new Promise((r, i) => o = r), o]; | ||
}, e.set = (n, o, r) => { | ||
(r = e.r[n]) && r[1](o), e.r[n] = [o]; | ||
}, e.unset = (n) => { | ||
delete e.r[n]; | ||
}, e.load = (n, r) => { | ||
if (r = e.r[n]) | ||
return r[0]; | ||
}, e.load = (n, o) => { | ||
if (o = e.r[n]) | ||
return o[0]; | ||
}; | ||
}; | ||
export { | ||
V as Appearance, | ||
Mt as Extensions, | ||
k as Markup, | ||
Y as PluginType, | ||
re as Selection, | ||
Hr as default, | ||
Mr as defineOptions, | ||
kr as hydrate, | ||
Hr as ink, | ||
hr as render, | ||
Ar as renderToString, | ||
br as solidPrepareForHydration | ||
W as Appearance, | ||
ut 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 | ||
}; | ||
//# sourceMappingURL=client.js.map |
{ | ||
"name": "ink-mde", | ||
"type": "module", | ||
"version": "0.22.0", | ||
"version": "0.23.0", | ||
"packageManager": "pnpm@7.27.0", | ||
@@ -116,3 +116,3 @@ "description": "A beautiful, modern, customizable Markdown editor powered by CodeMirror 6 and TypeScript.", | ||
"style-mod": "^4.0.0", | ||
"ink-mde": "0.22.0" | ||
"ink-mde": "0.23.0" | ||
}, | ||
@@ -119,0 +119,0 @@ "devDependencies": { |
@@ -48,3 +48,3 @@ [![NPM Package](https://img.shields.io/npm/v/ink-mde?color=blue&style=for-the-badge)](https://npmjs.com/package/ink-mde) | ||
``` | ||
https://esm.sh/ink-mde@0.21.0 | ||
https://esm.sh/ink-mde@0.22.0 | ||
``` | ||
@@ -55,3 +55,3 @@ | ||
```ts | ||
import { ink } from 'https://esm.sh/ink-mde@0.21.0' | ||
import { ink } from 'https://esm.sh/ink-mde@0.22.0' | ||
``` | ||
@@ -58,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
951285
8094
0
Updatedink-mde@0.23.0