@damiro/stylo 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +18 -9
  2. package/dist/{InPlaceView-B1GXXnoz.js → InPlaceView-CS1qy-Ba.js} +116 -115
  3. package/dist/{InPlaceView-B1GXXnoz.js.map → InPlaceView-CS1qy-Ba.js.map} +1 -1
  4. package/dist/{Preview-Dxb9zPVv.js → Preview-Bw0k3Mev.js} +2 -2
  5. package/dist/{Preview-Dxb9zPVv.js.map → Preview-Bw0k3Mev.js.map} +1 -1
  6. package/dist/SplitView.d.ts +3 -2
  7. package/dist/SplitView.d.ts.map +1 -1
  8. package/dist/Stylo.d.ts.map +1 -1
  9. package/dist/editor/SourceView.d.ts +4 -2
  10. package/dist/editor/SourceView.d.ts.map +1 -1
  11. package/dist/editor/extensions.d.ts +2 -2
  12. package/dist/editor/extensions.d.ts.map +1 -1
  13. package/dist/editor/theme.d.ts.map +1 -1
  14. package/dist/editor/useCodeMirror.d.ts +4 -2
  15. package/dist/editor/useCodeMirror.d.ts.map +1 -1
  16. package/dist/editor/wikilink-complete.d.ts +15 -0
  17. package/dist/editor/wikilink-complete.d.ts.map +1 -0
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/inplace/InPlaceView.d.ts +4 -2
  21. package/dist/inplace/InPlaceView.d.ts.map +1 -1
  22. package/dist/inplace/theme.d.ts.map +1 -1
  23. package/dist/styles.css +1 -1
  24. package/dist/stylo.js +58 -53
  25. package/dist/stylo.js.map +1 -1
  26. package/dist/types.d.ts +25 -0
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/{useCodeMirror-hLeJQw6e.js → useCodeMirror-GPSkaYW6.js} +203 -167
  29. package/dist/useCodeMirror-GPSkaYW6.js.map +1 -0
  30. package/dist/wikilink-CTR8IFKc.js +42 -0
  31. package/dist/wikilink-CTR8IFKc.js.map +1 -0
  32. package/package.json +4 -1
  33. package/dist/useCodeMirror-hLeJQw6e.js.map +0 -1
  34. package/dist/wikilink-BFpTehto.js +0 -42
  35. package/dist/wikilink-BFpTehto.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { i as e, n as t, t as n } from "./wikilink-BFpTehto.js";
2
- import { _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as ee, p as te, r as ne, s as re, t as ie, u as ae, v as oe, y as se } from "./useCodeMirror-hLeJQw6e.js";
3
- import { a as ce, i as h } from "./config-DTBxVhtH.js";
4
- import { t as le } from "./katex-BfiLlqfN.js";
5
- import { r as ue, t as g } from "./callout-oLE630ZP.js";
6
- import { useRef as de, useState as fe } from "react";
7
- import { Decoration as _, EditorView as v, ViewPlugin as y, WidgetType as b, hoverTooltip as pe, keymap as x } from "@codemirror/view";
1
+ import { i as e, n as t, t as n } from "./wikilink-CTR8IFKc.js";
2
+ import { _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as ee, r as te, s as ne, t as re, u as ie, v as ae, y as oe } from "./useCodeMirror-GPSkaYW6.js";
3
+ import { a as se, i as g } from "./config-DTBxVhtH.js";
4
+ import { t as ce } from "./katex-BfiLlqfN.js";
5
+ import { r as le, t as _ } from "./callout-oLE630ZP.js";
6
+ import { useRef as ue, useState as de } from "react";
7
+ import { Decoration as v, EditorView as y, ViewPlugin as b, WidgetType as x, hoverTooltip as fe, keymap as pe } from "@codemirror/view";
8
8
  import { Annotation as me, EditorSelection as he, EditorState as ge, Facet as S, Prec as C, StateEffect as _e, StateField as w } from "@codemirror/state";
9
9
  import { syntaxTree as T } from "@codemirror/language";
10
10
  import { jsx as ve } from "react/jsx-runtime";
@@ -66,23 +66,23 @@ var we = S.define({ combine: (e) => e[0] ?? j }), N = S.define({ combine: (e) =>
66
66
  //#endregion
67
67
  //#region src/inplace/frontmatter.ts
68
68
  function Te(e) {
69
- if (!e.facet(E).frontmatter) return _.none;
69
+ if (!e.facet(E).frontmatter) return v.none;
70
70
  let n = t(e.doc);
71
- if (!n) return _.none;
71
+ if (!n) return v.none;
72
72
  let r = e.doc.lineAt(n.from).number, i = e.doc.lineAt(n.to).number, a = e.selection.ranges.some((t) => {
73
73
  let n = e.doc.lineAt(t.from).number;
74
74
  return n >= r && n <= i;
75
75
  }), o = [];
76
76
  for (let t = r; t <= i; t++) {
77
77
  let n = e.doc.line(t), s = t === r ? "cm-inplace-fm cm-inplace-fm-first" : "cm-inplace-fm";
78
- o.push(_.line({ class: s }).range(n.from)), (t === r || t === i) && !a && n.to > n.from && o.push(_.replace({}).range(n.from, n.to));
78
+ o.push(v.line({ class: s }).range(n.from)), (t === r || t === i) && !a && n.to > n.from && o.push(v.replace({}).range(n.from, n.to));
79
79
  }
80
- return _.set(o, !0);
80
+ return v.set(o, !0);
81
81
  }
82
82
  var Ee = w.define({
83
83
  create: Te,
84
84
  update: (e, t) => t.docChanged || t.selection ? Te(t.state) : e,
85
- provide: (e) => v.decorations.from(e)
85
+ provide: (e) => y.decorations.from(e)
86
86
  });
87
87
  //#endregion
88
88
  //#region src/inplace/list-guides.ts
@@ -102,7 +102,7 @@ function Oe(e, t, n, r, i, a) {
102
102
  let t = De(e) - 1;
103
103
  if (t < 1) return;
104
104
  let n = r.lineAt(e.from).number, i = e.node.getChild("BulletList") ?? e.node.getChild("OrderedList"), s = r.lineAt(i ? i.from - 1 : Math.min(e.to, r.length)).number;
105
- for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(_.line({
105
+ for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(v.line({
106
106
  class: "cm-inplace-li",
107
107
  attributes: { style: `--sl-li-depth:${t}` }
108
108
  }).range(r.line(e).from)));
@@ -143,7 +143,7 @@ function I(e, t, n, r) {
143
143
  }
144
144
  //#endregion
145
145
  //#region src/inplace/math.ts
146
- var Ae = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, je = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, Me = /(?<![\w$])\$\$([^]+?)\$\$/g, L = class extends b {
146
+ var Ae = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, je = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, Me = /(?<![\w$])\$\$([^]+?)\$\$/g, L = class extends x {
147
147
  src;
148
148
  block;
149
149
  constructor(e, t) {
@@ -156,7 +156,7 @@ var Ae = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, je = /(?<![\w$])\$\$
156
156
  let e = document.createElement(this.block ? "div" : "span");
157
157
  e.className = this.block ? "cm-inplace-math cm-inplace-math-block" : "cm-inplace-math";
158
158
  try {
159
- le.render(this.src, e, {
159
+ ce.render(this.src, e, {
160
160
  displayMode: this.block,
161
161
  throwOnError: !1
162
162
  });
@@ -175,11 +175,11 @@ function Ne(e, t, n, r, i, a) {
175
175
  let { doc: s } = e.state, c = [];
176
176
  for (let e of o.matchAll(je)) {
177
177
  let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
178
- !n || F(i, o + 2) || (c.push([o, l]), !I(r, s, o, l) && a.push(_.replace({ widget: new L(n, !0) }).range(o, l)));
178
+ !n || F(i, o + 2) || (c.push([o, l]), !I(r, s, o, l) && a.push(v.replace({ widget: new L(n, !0) }).range(o, l)));
179
179
  }
180
180
  for (let e of o.matchAll(Ae)) {
181
181
  let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
182
- !n || F(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || I(r, s, o, l) || a.push(_.replace({ widget: new L(n, !1) }).range(o, l));
182
+ !n || F(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || I(r, s, o, l) || a.push(v.replace({ widget: new L(n, !1) }).range(o, l));
183
183
  }
184
184
  }
185
185
  var Pe = w.define({
@@ -187,27 +187,27 @@ var Pe = w.define({
187
187
  update(e, t) {
188
188
  return t.docChanged || t.selection ? Fe(t.state) : e;
189
189
  },
190
- provide: (e) => [v.decorations.from(e), v.atomicRanges.of((t) => t.state.field(e))]
190
+ provide: (e) => [y.decorations.from(e), y.atomicRanges.of((t) => t.state.field(e))]
191
191
  });
192
192
  function Fe(e) {
193
- if (!e.facet(E).math) return _.none;
193
+ if (!e.facet(E).math) return v.none;
194
194
  let t = e.doc.toString();
195
- if (!t.includes("$$")) return _.none;
195
+ if (!t.includes("$$")) return v.none;
196
196
  let n = [], r = P(e), i = T(e);
197
197
  for (let a of t.matchAll(Me)) {
198
198
  let t = a[0] ?? "", o = (a[1] ?? "").trim();
199
199
  if (!o || !t.includes("\n")) continue;
200
200
  let s = a.index ?? 0, c = s + t.length, l = e.doc.lineAt(s), u = e.doc.lineAt(c), d = e.doc.sliceString(l.from, s).trim(), f = e.doc.sliceString(c, u.to).trim();
201
- d === "" && f === "" && (F(i, s + 2) || I(r, e.doc, s, c) || n.push(_.replace({
201
+ d === "" && f === "" && (F(i, s + 2) || I(r, e.doc, s, c) || n.push(v.replace({
202
202
  widget: new L(o, !0),
203
203
  block: !0
204
204
  }).range(s, c)));
205
205
  }
206
- return _.set(n, !0);
206
+ return v.set(n, !0);
207
207
  }
208
208
  //#endregion
209
209
  //#region src/inplace/widgets.ts
210
- var Ie = class extends b {
210
+ var Ie = class extends x {
211
211
  eq() {
212
212
  return !0;
213
213
  }
@@ -218,7 +218,7 @@ var Ie = class extends b {
218
218
  ignoreEvent() {
219
219
  return !1;
220
220
  }
221
- }, Le = class extends b {
221
+ }, Le = class extends x {
222
222
  eq() {
223
223
  return !0;
224
224
  }
@@ -229,7 +229,7 @@ var Ie = class extends b {
229
229
  ignoreEvent() {
230
230
  return !1;
231
231
  }
232
- }, Re = class extends b {
232
+ }, Re = class extends x {
233
233
  checked;
234
234
  constructor(e) {
235
235
  super(), this.checked = e;
@@ -280,7 +280,7 @@ function Ue(e, t) {
280
280
  if (l) {
281
281
  if (o.headings) {
282
282
  let t = n.lineAt(e.from);
283
- if (a.push(_.line({
283
+ if (a.push(v.line({
284
284
  class: `cm-inplace-heading cm-inplace-h${l[1]}`,
285
285
  attributes: {
286
286
  role: "heading",
@@ -288,7 +288,7 @@ function Ue(e, t) {
288
288
  }
289
289
  }).range(t.from)), !r.has(t.number)) {
290
290
  let n = e.node.firstChild;
291
- n?.name === "HeaderMark" && a.push(_.replace({}).range(n.from, Math.min(n.to + 1, t.to)));
291
+ n?.name === "HeaderMark" && a.push(v.replace({}).range(n.from, Math.min(n.to + 1, t.to)));
292
292
  }
293
293
  }
294
294
  return;
@@ -297,7 +297,7 @@ function Ue(e, t) {
297
297
  if (u) {
298
298
  if (o.headings) {
299
299
  let t = n.lineAt(e.from);
300
- a.push(_.line({
300
+ a.push(v.line({
301
301
  class: `cm-inplace-heading cm-inplace-h${u[1]}`,
302
302
  attributes: {
303
303
  role: "heading",
@@ -307,7 +307,7 @@ function Ue(e, t) {
307
307
  let r = e.node.getChild("HeaderMark");
308
308
  if (r) {
309
309
  let e = n.lineAt(r.from);
310
- !i.has(t.number) && !i.has(e.number) && (a.push(_.line({ class: "cm-inplace-setext-rule" }).range(e.from)), a.push(_.replace({}).range(r.from, r.to)));
310
+ !i.has(t.number) && !i.has(e.number) && (a.push(v.line({ class: "cm-inplace-setext-rule" }).range(e.from)), a.push(v.replace({}).range(r.from, r.to)));
311
311
  }
312
312
  }
313
313
  return;
@@ -316,43 +316,43 @@ function Ue(e, t) {
316
316
  if (d) {
317
317
  if (!o[d.toggle]) return;
318
318
  let t = e.node.getChildren(d.mark), i = t[0], s = t[t.length - 1], c = i && s && i !== s, l = c ? i.to : e.from, u = c ? s.from : e.to;
319
- u > l && a.push(_.mark({ class: d.className }).range(l, u)), c && !r.has(n.lineAt(e.from).number) && (a.push(_.replace({}).range(i.from, i.to)), a.push(_.replace({}).range(s.from, s.to)));
319
+ u > l && a.push(v.mark({ class: d.className }).range(l, u)), c && !r.has(n.lineAt(e.from).number) && (a.push(v.replace({}).range(i.from, i.to)), a.push(v.replace({}).range(s.from, s.to)));
320
320
  return;
321
321
  }
322
322
  if (e.name === "Link") {
323
323
  let t = n.sliceString(Math.max(0, e.from - 1), e.from), i = n.sliceString(e.to, e.to + 1);
324
324
  if (t === "[" && i === "]" || !o.links) return !1;
325
- let s = n.lineAt(e.from), c = g.exec(s.text);
325
+ let s = n.lineAt(e.from), c = _.exec(s.text);
326
326
  if (c && e.from - s.from < c[1].length + c[2].length) return !1;
327
327
  let l = e.node.getChildren("LinkMark");
328
328
  if (l.length >= 2) {
329
329
  let t = l[0], i = l[1];
330
- i.from > t.to && a.push(_.mark({ class: "cm-inplace-link" }).range(t.to, i.from)), r.has(n.lineAt(e.from).number) || (a.push(_.replace({}).range(e.from, t.to)), a.push(_.replace({}).range(i.from, e.to)));
330
+ i.from > t.to && a.push(v.mark({ class: "cm-inplace-link" }).range(t.to, i.from)), r.has(n.lineAt(e.from).number) || (a.push(v.replace({}).range(e.from, t.to)), a.push(v.replace({}).range(i.from, e.to)));
331
331
  }
332
332
  return;
333
333
  }
334
334
  if (e.name === "HorizontalRule") {
335
335
  if (!o.horizontalRule) return !1;
336
336
  let t = n.lineAt(e.from);
337
- return i.has(t.number) || (a.push(_.line({ class: "cm-inplace-hr-line" }).range(t.from)), a.push(_.replace({ widget: new Ie() }).range(t.from, t.to))), !1;
337
+ return i.has(t.number) || (a.push(v.line({ class: "cm-inplace-hr-line" }).range(t.from)), a.push(v.replace({ widget: new Ie() }).range(t.from, t.to))), !1;
338
338
  }
339
339
  if (e.name === "Blockquote") {
340
340
  if (o.blockquote) {
341
- let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, s = n.line(t), l = g.exec(s.text), u = l ? ue(l[3]) : null, d = !1;
341
+ let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, s = n.line(t), l = _.exec(s.text), u = l ? le(l[3]) : null, d = !1;
342
342
  for (let e = t; e <= o; e++) i.has(e) && (d = !0);
343
343
  if (d) for (let e = t; e <= o; e++) c.add(e);
344
344
  for (let e = t; e <= o; e++) {
345
345
  let r = u ? `cm-inplace-callout cm-inplace-callout-${u}` : "cm-inplace-quote";
346
346
  u && e === t && (r += " cm-inplace-callout-head"), u && e === o && (r += " cm-inplace-callout-foot");
347
347
  let i = {};
348
- u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(_.line({
348
+ u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(v.line({
349
349
  class: r,
350
350
  attributes: i
351
351
  }).range(n.line(e).from));
352
352
  }
353
353
  if (u && !d && !r.has(t)) {
354
354
  let e = s.from + l[1].length;
355
- a.push(_.replace({}).range(e, e + l[2].length));
355
+ a.push(v.replace({}).range(e, e + l[2].length));
356
356
  }
357
357
  }
358
358
  return;
@@ -361,20 +361,20 @@ function Ue(e, t) {
361
361
  if (!o.blockquote) return !1;
362
362
  let t = n.lineAt(e.from);
363
363
  if (!r.has(t.number) && !c.has(t.number)) {
364
- let n = Math.min(e.to + 1, t.to), r = g.exec(t.text), i = r ? t.text.slice(r[1].length + r[2].length) : t.text.slice(n - t.from);
365
- a.push(_.replace({}).range(e.from, i.trim() === "" ? e.to : n));
364
+ let n = Math.min(e.to + 1, t.to), r = _.exec(t.text), i = r ? t.text.slice(r[1].length + r[2].length) : t.text.slice(n - t.from);
365
+ a.push(v.replace({}).range(e.from, i.trim() === "" ? e.to : n));
366
366
  }
367
367
  return !1;
368
368
  }
369
369
  if (e.name === "ListMark") {
370
370
  let t = n.sliceString(e.from, e.to), i = n.lineAt(e.from), s = e.node.parent, c = !!(s?.getChild("Task") ?? s?.getChild("TaskMarker"));
371
- return r.has(i.number) || (c ? o.tasks && a.push(_.replace({}).range(e.from, Math.min(e.to + 1, i.to))) : o.lists && Ve.test(t) && a.push(_.replace({ widget: new Le() }).range(e.from, e.to))), !1;
371
+ return r.has(i.number) || (c ? o.tasks && a.push(v.replace({}).range(e.from, Math.min(e.to + 1, i.to))) : o.lists && Ve.test(t) && a.push(v.replace({ widget: new Le() }).range(e.from, e.to))), !1;
372
372
  }
373
373
  if (e.name === "TaskMarker") {
374
374
  if (!o.tasks) return !1;
375
375
  if (!r.has(n.lineAt(e.from).number)) {
376
376
  let t = n.sliceString(e.from + 1, e.to - 1).toLowerCase() === "x";
377
- a.push(_.replace({ widget: new Re(t) }).range(e.from, e.to));
377
+ a.push(v.replace({ widget: new Re(t) }).range(e.from, e.to));
378
378
  }
379
379
  return !1;
380
380
  }
@@ -387,7 +387,7 @@ function Ue(e, t) {
387
387
  let i = t && (e === r || e === s), o = "cm-inplace-mono";
388
388
  e === r && (o += " cm-inplace-code-top"), e === s && (o += " cm-inplace-code-bottom"), i && (o += l ? " cm-inplace-code-pad" : " cm-inplace-fence");
389
389
  let c = n.line(e);
390
- a.push(_.line({ class: o }).range(c.from)), i && l && c.to > c.from && a.push(_.replace({}).range(c.from, c.to));
390
+ a.push(v.line({ class: o }).range(c.from)), i && l && c.to > c.from && a.push(v.replace({}).range(c.from, c.to));
391
391
  }
392
392
  return !1;
393
393
  }
@@ -400,15 +400,15 @@ function We(e, t, r, i, a, o) {
400
400
  let [n = "", s = "", c] = r, l = s.trim(), u = t + (r.index ?? 0);
401
401
  if (!l || F(a, u + 1)) continue;
402
402
  let d = u + n.length, f = c == null ? u + 2 : u + 2 + s.length + 1, p = d - 2;
403
- o.push(_.mark({
403
+ o.push(v.mark({
404
404
  class: "cm-inplace-link cm-inplace-wikilink",
405
405
  attributes: { "data-stylo-wikilink": l }
406
- }).range(f, p)), i.has(e.state.doc.lineAt(u).number) || (o.push(_.replace({}).range(u, f)), o.push(_.replace({}).range(p, d)));
406
+ }).range(f, p)), i.has(e.state.doc.lineAt(u).number) || (o.push(v.replace({}).range(u, f)), o.push(v.replace({}).range(p, d)));
407
407
  }
408
408
  }
409
409
  //#endregion
410
410
  //#region src/inplace/decorate.ts
411
- var Ge = /* @__PURE__ */ new Set(), Ke = _.replace({});
411
+ var Ge = /* @__PURE__ */ new Set(), Ke = v.replace({});
412
412
  function qe(e) {
413
413
  let n = [], r = P(e.state), i = e.state.facet(O) === "never" ? Ge : r, a = T(e.state), { doc: o } = e.state, s = e.state.facet(E), c = {
414
414
  doc: o,
@@ -434,13 +434,13 @@ function qe(e) {
434
434
  t && e.from <= t.to ? e.to > t.to && (u[u.length - 1] = Ke.range(t.from, e.to)) : u.push(Ke.range(e.from, e.to));
435
435
  }
436
436
  return {
437
- decorations: _.set(n, !0),
438
- atomic: _.set(u, !0)
437
+ decorations: v.set(n, !0),
438
+ atomic: v.set(u, !0)
439
439
  };
440
440
  }
441
441
  //#endregion
442
442
  //#region src/inplace/plugin.ts
443
- var R = y.fromClass(class {
443
+ var R = b.fromClass(class {
444
444
  decorations;
445
445
  atomic;
446
446
  constructor(e) {
@@ -455,7 +455,7 @@ var R = y.fromClass(class {
455
455
  }
456
456
  }, {
457
457
  decorations: (e) => e.decorations,
458
- provide: (e) => v.atomicRanges.of((t) => t.plugin(e)?.atomic ?? _.none)
458
+ provide: (e) => y.atomicRanges.of((t) => t.plugin(e)?.atomic ?? v.none)
459
459
  });
460
460
  function Je() {
461
461
  return R;
@@ -580,7 +580,7 @@ var V = (e, t) => (n) => {
580
580
  selection: a,
581
581
  userEvent: "select"
582
582
  }), !0;
583
- }, tt = V(!1, !1), nt = V(!0, !1), rt = V(!1, !0), it = V(!0, !0), at = C.high(x.of([
583
+ }, tt = V(!1, !1), nt = V(!0, !1), rt = V(!1, !0), it = V(!0, !0), at = C.high(pe.of([
584
584
  {
585
585
  key: "Backspace",
586
586
  run: Qe
@@ -605,7 +605,7 @@ var V = (e, t) => (n) => {
605
605
  key: "Shift-ArrowRight",
606
606
  run: it
607
607
  }
608
- ])), ot = (e) => e === "h1" || e === "h2" || e === "h3" ? h.heading : h[e], st = [
608
+ ])), ot = (e) => e === "h1" || e === "h2" || e === "h3" ? g.heading : g[e], st = [
609
609
  "bold",
610
610
  "italic",
611
611
  "strike"
@@ -656,17 +656,17 @@ var pt = (e, t, n = !1) => {
656
656
  return [
657
657
  {
658
658
  label: "Cut",
659
- icon: h.cut,
659
+ icon: g.cut,
660
660
  onSelect: n("cut")
661
661
  },
662
662
  {
663
663
  label: "Copy",
664
- icon: h.copy,
664
+ icon: g.copy,
665
665
  onSelect: n("copy")
666
666
  },
667
667
  i ? {
668
668
  label: "Paste",
669
- icon: h.paste,
669
+ icon: g.paste,
670
670
  onSelect: () => {
671
671
  let n = o(e);
672
672
  n || e.focus(), r?.readText().then((r) => {
@@ -675,7 +675,7 @@ var pt = (e, t, n = !1) => {
675
675
  }
676
676
  } : {
677
677
  label: "Paste",
678
- icon: h.paste,
678
+ icon: g.paste,
679
679
  disabled: !0,
680
680
  title: "Paste with the keyboard shortcut",
681
681
  onSelect: () => {}
@@ -688,13 +688,13 @@ var pt = (e, t, n = !1) => {
688
688
  function gt(e, t) {
689
689
  let n = e.doc.lineAt(t.from);
690
690
  if (e.doc.lineAt(t.to).number !== n.number) return null;
691
- let r = t.from - n.from, i = t.to - n.from, a = oe(n.text, r) ?? oe(n.text, i);
691
+ let r = t.from - n.from, i = t.to - n.from, a = ae(n.text, r) ?? ae(n.text, i);
692
692
  if (a) return {
693
693
  from: n.from + a.from,
694
694
  to: n.from + a.to,
695
695
  text: a.label
696
696
  };
697
- let o = se(n.text, r) ?? se(n.text, i);
697
+ let o = oe(n.text, r) ?? oe(n.text, i);
698
698
  return o ? {
699
699
  from: n.from + o.from,
700
700
  to: n.from + o.to,
@@ -702,12 +702,12 @@ function gt(e, t) {
702
702
  } : null;
703
703
  }
704
704
  function G(e) {
705
- let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = oe(r.text, n.head - r.from);
705
+ let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = ae(r.text, n.head - r.from);
706
706
  if (i) {
707
707
  let n = r.from + i.from, a = r.from + i.to, o = r.from + i.urlFrom, s = r.from + i.urlTo, c = t.facet(xe), l = [];
708
708
  return c && i.url && l.push({
709
709
  label: "Open link",
710
- icon: h.link,
710
+ icon: g.link,
711
711
  onSelect: () => c(i.url)
712
712
  }), l.push({
713
713
  label: "Remove link",
@@ -727,7 +727,7 @@ function G(e) {
727
727
  }), {
728
728
  field: !0,
729
729
  label: "Edit external link",
730
- icon: h.link,
730
+ icon: g.link,
731
731
  value: ht(i.url),
732
732
  placeholder: "https://…",
733
733
  onSubmit: (t) => {
@@ -744,7 +744,7 @@ function G(e) {
744
744
  return {
745
745
  field: !0,
746
746
  label: "Add external link",
747
- icon: h.link,
747
+ icon: g.link,
748
748
  value: "",
749
749
  placeholder: "https://…",
750
750
  onSubmit: (t) => {
@@ -769,7 +769,7 @@ function _t(e) {
769
769
  return {
770
770
  field: !0,
771
771
  label: "Edit link",
772
- icon: h.wikilink,
772
+ icon: g.wikilink,
773
773
  value: i.target,
774
774
  placeholder: "note or path",
775
775
  onSubmit: (t) => {
@@ -801,7 +801,7 @@ function _t(e) {
801
801
  return {
802
802
  field: !0,
803
803
  label: "Add link",
804
- icon: h.wikilink,
804
+ icon: g.wikilink,
805
805
  value: "",
806
806
  placeholder: "note or path",
807
807
  onSubmit: (t) => {
@@ -827,11 +827,11 @@ var K = (e, t, n, r = !1) => ({
827
827
  disabled: r
828
828
  });
829
829
  function vt(e) {
830
- let t = ee(e.state);
830
+ let t = h(e.state);
831
831
  return {
832
832
  field: !0,
833
833
  label: "Language",
834
- icon: h.codeBlock,
834
+ icon: g.codeBlock,
835
835
  value: t?.lang ?? "",
836
836
  placeholder: "ts, python, …",
837
837
  onSubmit: (n) => {
@@ -856,7 +856,7 @@ var yt = (e, t = !1) => [
856
856
  ];
857
857
  function bt(e) {
858
858
  let t = e.state.facet(M), n = [];
859
- return t.includes("format") && q(n, [K("Format", h.format, yt(e, !0))]), t.includes("clipboard") && q(n, W(e)), n;
859
+ return t.includes("format") && q(n, [K("Format", g.format, yt(e, !0))]), t.includes("clipboard") && q(n, W(e)), n;
860
860
  }
861
861
  var xt = (e) => [
862
862
  ...U(e, lt),
@@ -875,12 +875,12 @@ function q(e, t) {
875
875
  function Ct(e) {
876
876
  let { state: t } = e, n = t.facet(M), r = (e) => n.includes(e);
877
877
  if (H(e)) return bt(e);
878
- if (re(t)) {
878
+ if (ne(t)) {
879
879
  let t = [vt(e)];
880
880
  return r("clipboard") && q(t, W(e)), t;
881
881
  }
882
882
  let i = t.selection.main, a = t.doc.lineAt(i.head).text.trim() === "", o = !i.empty || !!t.wordAt(i.head), s = t.facet(N) === "menu", c = [];
883
- for (let t of n) t === "link" && s ? q(c, [_t(e), G(e)]) : t === "format" && s ? q(c, [K("Format", h.format, yt(e), !o)]) : t === "paragraph" ? q(c, [K("Paragraph", h.paragraph, xt(e))]) : t === "insert" ? q(c, [K("Insert", h.insert, St(e), !a)]) : t === "clipboard" && q(c, W(e));
883
+ for (let t of n) t === "link" && s ? q(c, [_t(e), G(e)]) : t === "format" && s ? q(c, [K("Format", g.format, yt(e), !o)]) : t === "paragraph" ? q(c, [K("Paragraph", g.paragraph, xt(e))]) : t === "insert" ? q(c, [K("Insert", g.insert, St(e), !a)]) : t === "clipboard" && q(c, W(e));
884
884
  return c;
885
885
  }
886
886
  //#endregion
@@ -898,7 +898,7 @@ var Tt = [
898
898
  re: /(?<![\d$])\$(?!\s)([^$\n]+?)(?<!\s)\$(?![\d$])/,
899
899
  build: (e) => {
900
900
  let t = J("span", "cm-inplace-math");
901
- return le.render(e[1], t, { throwOnError: !1 }), t;
901
+ return ce.render(e[1], t, { throwOnError: !1 }), t;
902
902
  }
903
903
  },
904
904
  {
@@ -992,7 +992,7 @@ function X(e, t = "cm-inplace-menu", n) {
992
992
  }, l = (e) => e.addEventListener("mousedown", (e) => {
993
993
  e.preventDefault(), e.stopPropagation();
994
994
  }), u = (t, n, r) => {
995
- r && t.appendChild(ce(e, r));
995
+ r && t.appendChild(se(e, r));
996
996
  let i = e.createElement("span");
997
997
  i.textContent = n, t.appendChild(i);
998
998
  }, d = (n) => {
@@ -1010,7 +1010,7 @@ function X(e, t = "cm-inplace-menu", n) {
1010
1010
  if (a?.dataset.for === n) return;
1011
1011
  s();
1012
1012
  let e = o();
1013
- e.dataset.for = n, i.appendChild(e), te(e, d.getBoundingClientRect()), a = e, e.querySelector("input")?.focus({ preventScroll: !0 });
1013
+ e.dataset.for = n, i.appendChild(e), ee(e, d.getBoundingClientRect()), a = e, e.querySelector("input")?.focus({ preventScroll: !0 });
1014
1014
  };
1015
1015
  return d.addEventListener("pointerenter", f), d.addEventListener("click", (e) => {
1016
1016
  e.stopPropagation(), f();
@@ -1035,17 +1035,17 @@ function X(e, t = "cm-inplace-menu", n) {
1035
1035
  n.className = `${t}-sep`, r.appendChild(n);
1036
1036
  } else Ot(i) ? r.appendChild(f(i.label, i.icon, () => m(i.rows), i.disabled)) : kt(i) ? r.appendChild(f(i.label, i.icon, () => p(i))) : r.appendChild(d(i));
1037
1037
  return r;
1038
- }, ee = (e, t, n) => {
1038
+ }, h = (e, t, n) => {
1039
1039
  let i = r?.innerWidth ?? 0, a = r?.innerHeight ?? 0;
1040
1040
  e.style.left = "0", e.style.top = "0";
1041
1041
  let { width: o, height: s } = e.getBoundingClientRect();
1042
1042
  e.style.left = `${Math.max(4, Math.min(t, i - o - 4))}px`, e.style.top = `${Math.max(4, Math.min(n, a - s - 4))}px`;
1043
- }, te = (e, t) => {
1043
+ }, ee = (e, t) => {
1044
1044
  let n = r?.innerWidth ?? 0, i = r?.innerHeight ?? 0;
1045
1045
  e.style.left = "0", e.style.top = "0";
1046
1046
  let { width: a, height: o } = e.getBoundingClientRect(), s = t.right - 4, c = s + a > n - 4 ? t.left - a + 4 : s;
1047
1047
  e.style.left = `${Math.max(4, c)}px`, e.style.top = `${Math.max(4, Math.min(t.top - 4, i - o - 4))}px`;
1048
- }, ne = () => {
1048
+ }, te = () => {
1049
1049
  let t = Date.now(), n = (e) => !i.contains(e.target), r = (e) => {
1050
1050
  n(e) && c();
1051
1051
  }, a = (e) => {
@@ -1065,12 +1065,12 @@ function X(e, t = "cm-inplace-menu", n) {
1065
1065
  show: (e, t, r) => {
1066
1066
  c();
1067
1067
  let a = m(e);
1068
- i.appendChild(a), i.hidden = !1, ee(a, t, r), ne(), n?.(!0);
1068
+ i.appendChild(a), i.hidden = !1, h(a, t, r), te(), n?.(!0);
1069
1069
  },
1070
1070
  showField: (e, t, r) => {
1071
1071
  c();
1072
1072
  let a = p(e);
1073
- i.appendChild(a), i.hidden = !1, ee(a, t, r), a.querySelector("input")?.focus({ preventScroll: !0 }), ne(), n?.(!0);
1073
+ i.appendChild(a), i.hidden = !1, h(a, t, r), a.querySelector("input")?.focus({ preventScroll: !0 }), te(), n?.(!0);
1074
1074
  },
1075
1075
  hide: c,
1076
1076
  destroy: () => {
@@ -1190,7 +1190,7 @@ function Ft(e, t, n) {
1190
1190
  }
1191
1191
  //#endregion
1192
1192
  //#region src/inplace/table-widget.ts
1193
- var Q = me.define(), It = class extends b {
1193
+ var Q = me.define(), It = class extends x {
1194
1194
  data;
1195
1195
  table = null;
1196
1196
  rows;
@@ -1202,7 +1202,7 @@ var Q = me.define(), It = class extends b {
1202
1202
  longPress = null;
1203
1203
  longPressAt = 0;
1204
1204
  constructor(e) {
1205
- super(), this.data = e, this.rows = ae(e), this.current = l(this.rows);
1205
+ super(), this.data = e, this.rows = ie(e), this.current = l(this.rows);
1206
1206
  }
1207
1207
  eq(e) {
1208
1208
  return !this.table && JSON.stringify(this.current) === JSON.stringify(e.current);
@@ -1279,7 +1279,7 @@ var Q = me.define(), It = class extends b {
1279
1279
  onFocusIn(e) {
1280
1280
  let t = e.target.closest("td, th");
1281
1281
  if (!t || t === this.editing) return;
1282
- let n = this.pendingOffset ?? te(t);
1282
+ let n = this.pendingOffset ?? ee(t);
1283
1283
  this.pendingOffset = null, this.editing && this.finish(this.editing, !1), this.editing = t, this.paint(t, !0), c(t, n);
1284
1284
  }
1285
1285
  onFocusOut(e) {
@@ -1559,7 +1559,7 @@ function Ut(e) {
1559
1559
  }
1560
1560
  return null;
1561
1561
  }
1562
- var Wt = C.high(x.of([{
1562
+ var Wt = C.high(pe.of([{
1563
1563
  key: "Backspace",
1564
1564
  run: (e) => {
1565
1565
  if (o(e)) return !1;
@@ -1605,7 +1605,7 @@ var Wt = C.high(x.of([{
1605
1605
  destroy() {
1606
1606
  this.contentDOM.removeEventListener("click", this.onClick), this.menu.destroy();
1607
1607
  }
1608
- }, Kt = y.fromClass(Gt), qt = (e) => e.replace(/^<([^]*)>$/, "$1").trim(), Jt = (e, t, n) => n ? {
1608
+ }, Kt = b.fromClass(Gt), qt = (e) => e.replace(/^<([^]*)>$/, "$1").trim(), Jt = (e, t, n) => n ? {
1609
1609
  pos: e,
1610
1610
  end: t,
1611
1611
  above: !0,
@@ -1631,7 +1631,7 @@ function Xt(e, t) {
1631
1631
  }
1632
1632
  return null;
1633
1633
  }
1634
- var Zt = pe((e, t) => {
1634
+ var Zt = fe((e, t) => {
1635
1635
  let n = e.state.facet(E);
1636
1636
  return (n.links ? Yt(e, t) : null) ?? (n.wikilinks ? Xt(e, t) : null);
1637
1637
  }), Qt = _e.define(), $ = w.define({
@@ -1692,7 +1692,7 @@ var Zt = pe((e, t) => {
1692
1692
  destroy() {
1693
1693
  this.destroyed = !0, this.contentDOM.removeEventListener("pointerdown", this.onPointerDown, !0), this.contentDOM.removeEventListener("contextmenu", this.onContextMenu), this.longPress.dispose(), this.menu.destroy();
1694
1694
  }
1695
- }, en = y.fromClass($t), tn = class {
1695
+ }, en = b.fromClass($t), tn = class {
1696
1696
  view;
1697
1697
  bar;
1698
1698
  ids;
@@ -1710,7 +1710,7 @@ var Zt = pe((e, t) => {
1710
1710
  this.ids = e.state.facet(we), this.linkMenu = X(t), e.dom.appendChild(this.linkMenu.el), this.bar = t.createElement("div"), this.bar.className = "cm-inplace-selbar", this.bar.setAttribute("contenteditable", "false"), this.bar.hidden = !0;
1711
1711
  for (let n of this.ids) {
1712
1712
  let r = m[n], i = t.createElement("button");
1713
- i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(ce(t, h[n] ?? "")), i.addEventListener("mousedown", (e) => e.preventDefault()), i.addEventListener("click", (t) => {
1713
+ i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(se(t, g[n] ?? "")), i.addEventListener("mousedown", (e) => e.preventDefault()), i.addEventListener("click", (t) => {
1714
1714
  t.preventDefault();
1715
1715
  let a = !!o(e), s = !a && n === "link" ? G(e) : !a && n === "wikilink" ? _t(e) : null;
1716
1716
  if (s) {
@@ -1793,7 +1793,7 @@ var Zt = pe((e, t) => {
1793
1793
  let e = this.view.dom.ownerDocument;
1794
1794
  e.removeEventListener("scroll", this.onScroll, !0), e.removeEventListener("selectionchange", this.onSelectionChange), this.linkMenu.destroy(), this.bar.remove();
1795
1795
  }
1796
- }, nn = y.fromClass(tn), rn = class extends b {
1796
+ }, nn = b.fromClass(tn), rn = class extends x {
1797
1797
  table;
1798
1798
  constructor(e) {
1799
1799
  super(), this.table = e;
@@ -1836,7 +1836,7 @@ function on(e, t) {
1836
1836
  };
1837
1837
  }
1838
1838
  function sn(e) {
1839
- if (!e.facet(E).tables) return _.none;
1839
+ if (!e.facet(E).tables) return v.none;
1840
1840
  let n = e.facet(D) === "cells", r = T(e), i = t(e.doc), a = n ? null : P(e), o = [];
1841
1841
  return r.iterate({ enter: (t) => {
1842
1842
  if (t.name !== "Table") return;
@@ -1848,18 +1848,18 @@ function sn(e) {
1848
1848
  let r = on(t.node, e.doc);
1849
1849
  if (r) {
1850
1850
  let e = n ? new It(r) : new rn(r);
1851
- o.push(_.replace({
1851
+ o.push(v.replace({
1852
1852
  widget: e,
1853
1853
  block: !0
1854
1854
  }).range(t.from, t.to));
1855
1855
  }
1856
1856
  return !1;
1857
- } }), _.set(o, !0);
1857
+ } }), v.set(o, !0);
1858
1858
  }
1859
1859
  var cn = w.define({
1860
1860
  create: sn,
1861
1861
  update: (e, t) => t.annotation(Q) ? e.map(t.changes) : t.state.facet(D) === "cells" ? t.docChanged ? sn(t.state) : e.map(t.changes) : t.docChanged || t.selection ? sn(t.state) : e,
1862
- provide: (e) => [v.decorations.from(e), v.atomicRanges.of((t) => t.state.field(e))]
1862
+ provide: (e) => [y.decorations.from(e), y.atomicRanges.of((t) => t.state.field(e))]
1863
1863
  }), ln = (e) => (t) => {
1864
1864
  if (o(t)) return !1;
1865
1865
  let n = t.state.selection.main;
@@ -1877,15 +1877,15 @@ var cn = w.define({
1877
1877
  userEvent: "select",
1878
1878
  scrollIntoView: !0
1879
1879
  }), !0;
1880
- }, un = ln(!0), dn = ln(!1), fn = C.high(x.of([{
1880
+ }, un = ln(!0), dn = ln(!1), fn = C.high(pe.of([{
1881
1881
  key: "ArrowDown",
1882
1882
  run: un
1883
1883
  }, {
1884
1884
  key: "ArrowUp",
1885
1885
  run: dn
1886
- }])), pn = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", mn = v.theme({
1886
+ }])), pn = "var(--stylo-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)", mn = "var(--stylo-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif)", hn = y.theme({
1887
1887
  "& .cm-content": {
1888
- fontFamily: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
1888
+ fontFamily: mn,
1889
1889
  lineHeight: "1.75",
1890
1890
  padding: "0.75rem",
1891
1891
  WebkitTouchCallout: "none"
@@ -2036,7 +2036,7 @@ var cn = w.define({
2036
2036
  ".cm-inplace-fm-first::before": {
2037
2037
  content: "\"Frontmatter\"",
2038
2038
  marginRight: "0.6em",
2039
- fontFamily: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
2039
+ fontFamily: mn,
2040
2040
  fontSize: "0.8rem",
2041
2041
  fontWeight: "600",
2042
2042
  textTransform: "uppercase",
@@ -2262,8 +2262,8 @@ var cn = w.define({
2262
2262
  lineHeight: "1.4",
2263
2263
  wordBreak: "break-all"
2264
2264
  }
2265
- }), hn = ".cm-inplace-math, .cm-inplace-hr, .cm-inplace-table";
2266
- function gn(e, t, n) {
2265
+ }), gn = ".cm-inplace-math, .cm-inplace-hr, .cm-inplace-table";
2266
+ function _n(e, t, n) {
2267
2267
  let r = e.firstChild, i = e.textContent?.length ?? 0;
2268
2268
  if (!r || r.nodeType !== Node.TEXT_NODE || i === 0) return 0;
2269
2269
  let a = e.ownerDocument, o = null, s = 0;
@@ -2276,7 +2276,7 @@ function gn(e, t, n) {
2276
2276
  }
2277
2277
  return o === r ? Math.min(s, i) : o === e && s > 0 ? i : 0;
2278
2278
  }
2279
- function _n(e = {}) {
2279
+ function vn(e = {}) {
2280
2280
  let t = Se(e.inPlace?.contextMenu);
2281
2281
  return [
2282
2282
  E.of(be(e.inPlace)),
@@ -2301,19 +2301,19 @@ function _n(e = {}) {
2301
2301
  nn,
2302
2302
  Kt,
2303
2303
  Zt,
2304
- C.high(mn),
2305
- v.domEventHandlers({
2304
+ C.high(hn),
2305
+ y.domEventHandlers({
2306
2306
  mousedown(e, t) {
2307
2307
  let n = e.target;
2308
2308
  if (n?.closest(".cm-inplace-table-edit")) return !1;
2309
- let r = n?.closest(hn);
2309
+ let r = n?.closest(gn);
2310
2310
  if (!r) return !1;
2311
2311
  let i = t.posAtDOM(r);
2312
2312
  if (i < 0) return !1;
2313
2313
  let a = n?.closest("[data-stylo-row]");
2314
2314
  if (a && r.contains(a)) {
2315
- let n = ne(t.state.doc, i, Number(a.dataset.styloRow), Number(a.dataset.styloCol));
2316
- n != null && (i = n + gn(a, e.clientX, e.clientY));
2315
+ let n = te(t.state.doc, i, Number(a.dataset.styloRow), Number(a.dataset.styloCol));
2316
+ n != null && (i = n + _n(a, e.clientX, e.clientY));
2317
2317
  }
2318
2318
  return t.focus(), t.dispatch({ selection: { anchor: i } }), !0;
2319
2319
  },
@@ -2327,31 +2327,32 @@ function _n(e = {}) {
2327
2327
  }
2328
2328
  //#endregion
2329
2329
  //#region src/inplace/InPlaceView.tsx
2330
- function vn({ value: t, onChange: n, readOnly: r, placeholder: i, onWikiLinkClick: a, onLinkClick: o, inPlace: s, codeLanguages: c, onSave: l, onViewChange: u }) {
2331
- let d = de(a);
2332
- d.current = a;
2333
- let f = de(o);
2334
- f.current = o;
2335
- let [p] = fe(() => [_n({
2336
- onWikiLinkClick: (e) => d.current?.(e),
2337
- onLinkClick: (e) => f.current?.(e),
2330
+ function yn({ value: t, onChange: n, readOnly: r, placeholder: i, onWikiLinkClick: a, onLinkClick: o, inPlace: s, codeLanguages: c, wikiLinkSource: l, onSave: u, onViewChange: d }) {
2331
+ let f = ue(a);
2332
+ f.current = a;
2333
+ let p = ue(o);
2334
+ p.current = o;
2335
+ let [m] = de(() => [vn({
2336
+ onWikiLinkClick: (e) => f.current?.(e),
2337
+ onLinkClick: (e) => p.current?.(e),
2338
2338
  inPlace: s
2339
- })]), m = ie({
2339
+ })]), h = re({
2340
2340
  value: t,
2341
2341
  onChange: n,
2342
2342
  readOnly: r,
2343
2343
  placeholder: i,
2344
- extensions: p,
2344
+ extensions: m,
2345
2345
  codeLanguages: c,
2346
- onSave: l,
2347
- onViewChange: u
2346
+ wikiLinkSource: l,
2347
+ onSave: u,
2348
+ onViewChange: d
2348
2349
  });
2349
2350
  return /* @__PURE__ */ ve("div", {
2350
2351
  className: e.inplace,
2351
- ref: m
2352
+ ref: h
2352
2353
  });
2353
2354
  }
2354
2355
  //#endregion
2355
- export { vn as InPlaceView };
2356
+ export { yn as InPlaceView };
2356
2357
 
2357
- //# sourceMappingURL=InPlaceView-B1GXXnoz.js.map
2358
+ //# sourceMappingURL=InPlaceView-CS1qy-Ba.js.map