@clevertask/scribe 0.1.0 → 0.1.1

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 (37) hide show
  1. package/README.md +60 -16
  2. package/dist/{BarMenu-BDtEfu-R.js → BarMenu-DaKIz3zZ.js} +1 -1
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.js +2 -2
  5. package/dist/components/Menu/BubbleMenu.js +78 -74
  6. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  7. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  8. package/dist/components/Scribe/extension/extension-link.js +1 -1
  9. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  10. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  11. package/dist/components/Scribe/extension/index.d.ts +16 -2
  12. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  13. package/dist/components/Scribe/extension/index.js +2655 -2580
  14. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +1616 -1618
  15. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  16. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  17. package/dist/components/Scribe/extension/tableOfContents.d.ts +48 -0
  18. package/dist/components/Scribe/extension/tableOfContents.d.ts.map +1 -0
  19. package/dist/components/Scribe/extension/tableOfContents.js +180 -0
  20. package/dist/components/Scribe/index.d.ts +12 -0
  21. package/dist/components/Scribe/index.d.ts.map +1 -1
  22. package/dist/components/Scribe/index.js +108 -65
  23. package/dist/{extension-link-D3eyOFkn.js → extension-link-Ch_T7WWG.js} +1 -1
  24. package/dist/{index-hHvpW2H6.js → index-BiBV5TQx.js} +1287 -1250
  25. package/dist/{index-FY_iYS6i.js → index-CqzMmrnw.js} +1 -1
  26. package/dist/{index-PJNQPLn5.js → index-DxF-1P4n.js} +196 -203
  27. package/dist/index-V-gN11Y9.js +249 -0
  28. package/dist/main.js +1 -1
  29. package/dist/{markdown-to-html-BwS08CTi.js → markdown-to-html-pL7ckd-m.js} +14 -14
  30. package/dist/purify.es-exIQuqhb.js +595 -0
  31. package/dist/utils/create-scribe-editor.js +3 -3
  32. package/dist/utils/html-to-markdown.js +226 -306
  33. package/dist/utils/index.js +1 -1
  34. package/dist/utils/markdown-to-html.js +2 -2
  35. package/package.json +30 -30
  36. package/dist/index-DZylq4Bc.js +0 -232
  37. package/dist/purify.es-BPDBzHtc.js +0 -552
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@radix-ui/themes";
3
- import { B as f } from "../../BarMenu-BDtEfu-R.js";
4
- import "../../index-PJNQPLn5.js";
3
+ import { B as f } from "../../BarMenu-DaKIz3zZ.js";
4
+ import "../../index-DxF-1P4n.js";
5
5
  import "react";
6
6
  import "../Scribe/extension/getPopupMountTarget.js";
7
7
  import "../../icons/ToolbarIcons.js";
@@ -1,12 +1,12 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { Flex as ve, IconButton as ye } from "@radix-ui/themes";
3
- import { a as Bt, u as be } from "../../index-PJNQPLn5.js";
4
- import { b as zt, P as vt, p as xe, q as Vt, N as Oe, a as Nt, r as Se, s as Ce } from "../../index-hHvpW2H6.js";
5
- import { C as Te } from "../../index-FY_iYS6i.js";
3
+ import { a as Bt, u as be } from "../../index-DxF-1P4n.js";
4
+ import { b as Vt, P as vt, p as xe, q as zt, N as Oe, a as Nt, r as Ce, s as Se } from "../../index-BiBV5TQx.js";
5
+ import { C as Te } from "../../index-CqzMmrnw.js";
6
6
  import _t, { useRef as k, useState as Wt, useEffect as it, useLayoutEffect as Ee, useCallback as Re } from "react";
7
7
  import { createPortal as kt } from "react-dom";
8
8
  import { getPopupMountTarget as Ie } from "../Scribe/extension/getPopupMountTarget.js";
9
- const Ft = ["top", "right", "bottom", "left"], Ct = ["start", "end"], Tt = /* @__PURE__ */ Ft.reduce((t, e) => t.concat(e, e + "-" + Ct[0], e + "-" + Ct[1]), []), K = Math.min, D = Math.max, st = Math.round, $ = (t) => ({
9
+ const Ft = ["top", "right", "bottom", "left"], St = ["start", "end"], Tt = /* @__PURE__ */ Ft.reduce((t, e) => t.concat(e, e + "-" + St[0], e + "-" + St[1]), []), K = Math.min, D = Math.max, st = Math.round, $ = (t) => ({
10
10
  x: t,
11
11
  y: t
12
12
  }), Le = {
@@ -21,7 +21,7 @@ function gt(t, e, n) {
21
21
  function j(t, e) {
22
22
  return typeof t == "function" ? t(e) : t;
23
23
  }
24
- function z(t) {
24
+ function V(t) {
25
25
  return t.split("-")[0];
26
26
  }
27
27
  function N(t) {
@@ -68,11 +68,11 @@ function Me(t, e, n) {
68
68
  }
69
69
  function Pe(t, e, n, o) {
70
70
  const i = N(t);
71
- let s = Me(z(t), n === "start", o);
71
+ let s = Me(V(t), n === "start", o);
72
72
  return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(rt)))), s;
73
73
  }
74
74
  function lt(t) {
75
- const e = z(t);
75
+ const e = V(t);
76
76
  return Le[e] + t.slice(e.length);
77
77
  }
78
78
  function Ue(t) {
@@ -115,7 +115,7 @@ function It(t, e, n) {
115
115
  reference: o,
116
116
  floating: i
117
117
  } = t;
118
- const s = F(e), r = bt(e), l = yt(r), c = z(e), p = s === "y", f = o.x + o.width / 2 - i.width / 2, a = o.y + o.height / 2 - i.height / 2, d = o[l] / 2 - i[l] / 2;
118
+ const s = F(e), r = bt(e), l = yt(r), c = V(e), p = s === "y", f = o.x + o.width / 2 - i.width / 2, a = o.y + o.height / 2 - i.height / 2, d = o[l] / 2 - i[l] / 2;
119
119
  let u;
120
120
  switch (c) {
121
121
  case "top":
@@ -190,20 +190,20 @@ async function Be(t, e) {
190
190
  } : {
191
191
  x: 1,
192
192
  y: 1
193
- }, S = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
193
+ }, C = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
194
194
  elements: l,
195
195
  rect: y,
196
196
  offsetParent: w,
197
197
  strategy: c
198
198
  }) : y);
199
199
  return {
200
- top: (v.top - S.top + h.top) / b.y,
201
- bottom: (S.bottom - v.bottom + h.bottom) / b.y,
202
- left: (v.left - S.left + h.left) / b.x,
203
- right: (S.right - v.right + h.right) / b.x
200
+ top: (v.top - C.top + h.top) / b.y,
201
+ bottom: (C.bottom - v.bottom + h.bottom) / b.y,
202
+ left: (v.left - C.left + h.left) / b.x,
203
+ right: (C.right - v.right + h.right) / b.x
204
204
  };
205
205
  }
206
- const ze = 50, Ve = async (t, e, n) => {
206
+ const Ve = 50, ze = async (t, e, n) => {
207
207
  const {
208
208
  placement: o = "bottom",
209
209
  strategy: i = "absolute",
@@ -232,7 +232,7 @@ const ze = 50, Ve = async (t, e, n) => {
232
232
  } = m, {
233
233
  x: w,
234
234
  y: b,
235
- data: S,
235
+ data: C,
236
236
  reset: O
237
237
  } = await y({
238
238
  x: f,
@@ -250,8 +250,8 @@ const ze = 50, Ve = async (t, e, n) => {
250
250
  });
251
251
  f = w ?? f, a = b ?? a, h[v] = {
252
252
  ...h[v],
253
- ...S
254
- }, O && u < ze && (u++, typeof O == "object" && (O.placement && (d = O.placement), O.rects && (p = O.rects === !0 ? await r.getElementRects({
253
+ ...C
254
+ }, O && u < Ve && (u++, typeof O == "object" && (O.placement && (d = O.placement), O.rects && (p = O.rects === !0 ? await r.getElementRects({
255
255
  reference: t,
256
256
  floating: e,
257
257
  strategy: i
@@ -288,15 +288,15 @@ const ze = 50, Ve = async (t, e, n) => {
288
288
  const a = xt(f), d = {
289
289
  x: n,
290
290
  y: o
291
- }, u = bt(i), h = yt(u), g = await r.getDimensions(p), m = u === "y", v = m ? "top" : "left", y = m ? "bottom" : "right", w = m ? "clientHeight" : "clientWidth", b = s.reference[h] + s.reference[u] - d[u] - s.floating[h], S = d[u] - s.reference[u], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(p));
291
+ }, u = bt(i), h = yt(u), g = await r.getDimensions(p), m = u === "y", v = m ? "top" : "left", y = m ? "bottom" : "right", w = m ? "clientHeight" : "clientWidth", b = s.reference[h] + s.reference[u] - d[u] - s.floating[h], C = d[u] - s.reference[u], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(p));
292
292
  let R = O ? O[w] : 0;
293
293
  (!R || !await (r.isElement == null ? void 0 : r.isElement(O))) && (R = l.floating[w] || s.floating[h]);
294
- const U = b / 2 - S / 2, I = R / 2 - g[h] / 2 - 1, x = K(a[v], I), C = K(a[y], I), L = x, H = R - g[h] - C, T = R / 2 - g[h] / 2 + U, V = gt(L, T, H), B = !c.arrow && N(i) != null && T !== V && s.reference[h] / 2 - (T < L ? x : C) - g[h] / 2 < 0, A = B ? T < L ? T - L : T - H : 0;
294
+ const U = b / 2 - C / 2, I = R / 2 - g[h] / 2 - 1, x = K(a[v], I), S = K(a[y], I), L = x, H = R - g[h] - S, T = R / 2 - g[h] / 2 + U, z = gt(L, T, H), B = !c.arrow && N(i) != null && T !== z && s.reference[h] / 2 - (T < L ? x : S) - g[h] / 2 < 0, A = B ? T < L ? T - L : T - H : 0;
295
295
  return {
296
296
  [u]: d[u] + A,
297
297
  data: {
298
- [u]: V,
299
- centerOffset: T - V - A,
298
+ [u]: z,
299
+ centerOffset: T - z - A,
300
300
  ...B && {
301
301
  alignmentOffset: A
302
302
  }
@@ -306,7 +306,7 @@ const ze = 50, Ve = async (t, e, n) => {
306
306
  }
307
307
  });
308
308
  function _e(t, e, n) {
309
- return (t ? [...n.filter((i) => N(i) === t), ...n.filter((i) => N(i) !== t)] : n.filter((i) => z(i) === i)).filter((i) => t ? N(i) === t || (e ? rt(i) !== i : !1) : !0);
309
+ return (t ? [...n.filter((i) => N(i) === t), ...n.filter((i) => N(i) !== t)] : n.filter((i) => V(i) === i)).filter((i) => t ? N(i) === t || (e ? rt(i) !== i : !1) : !0);
310
310
  }
311
311
  const We = function(t) {
312
312
  return t === void 0 && (t = {}), {
@@ -336,7 +336,7 @@ const We = function(t) {
336
336
  placement: g[0]
337
337
  }
338
338
  };
339
- const b = [m[z(y)], m[w[0]], m[w[1]]], S = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
339
+ const b = [m[V(y)], m[w[0]], m[w[1]]], C = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
340
340
  placement: y,
341
341
  overflows: b
342
342
  }], O = g[v + 1];
@@ -344,31 +344,31 @@ const We = function(t) {
344
344
  return {
345
345
  data: {
346
346
  index: v + 1,
347
- overflows: S
347
+ overflows: C
348
348
  },
349
349
  reset: {
350
350
  placement: O
351
351
  }
352
352
  };
353
- const R = S.map((x) => {
354
- const C = N(x.placement);
355
- return [x.placement, C && f ? (
353
+ const R = C.map((x) => {
354
+ const S = N(x.placement);
355
+ return [x.placement, S && f ? (
356
356
  // Check along the mainAxis and main crossAxis side.
357
357
  x.overflows.slice(0, 2).reduce((L, H) => L + H, 0)
358
358
  ) : (
359
359
  // Check only the mainAxis.
360
360
  x.overflows[0]
361
361
  ), x.overflows];
362
- }).sort((x, C) => x[1] - C[1]), I = ((i = R.filter((x) => x[2].slice(
362
+ }).sort((x, S) => x[1] - S[1]), I = ((i = R.filter((x) => x[2].slice(
363
363
  0,
364
364
  // Aligned placements should not check their opposite crossAxis
365
365
  // side.
366
366
  N(x[0]) ? 2 : 3
367
- ).every((C) => C <= 0))[0]) == null ? void 0 : i[0]) || R[0][0];
367
+ ).every((S) => S <= 0))[0]) == null ? void 0 : i[0]) || R[0][0];
368
368
  return I !== l ? {
369
369
  data: {
370
370
  index: v + 1,
371
- overflows: S
371
+ overflows: C
372
372
  },
373
373
  reset: {
374
374
  placement: I
@@ -400,9 +400,9 @@ const We = function(t) {
400
400
  } = j(t, e);
401
401
  if ((n = s.arrow) != null && n.alignmentOffset)
402
402
  return {};
403
- const v = z(i), y = F(l), w = z(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(p.floating)), S = d || (w || !g ? [lt(l)] : De(l)), O = h !== "none";
404
- !d && O && S.push(...Pe(l, g, h, b));
405
- const R = [l, ...S], U = await c.detectOverflow(e, m), I = [];
403
+ const v = V(i), y = F(l), w = V(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(p.floating)), C = d || (w || !g ? [lt(l)] : De(l)), O = h !== "none";
404
+ !d && O && C.push(...Pe(l, g, h, b));
405
+ const R = [l, ...C], U = await c.detectOverflow(e, m), I = [];
406
406
  let x = ((o = s.flip) == null ? void 0 : o.overflows) || [];
407
407
  if (f && I.push(U[v]), a) {
408
408
  const T = Kt(i, r, b);
@@ -412,9 +412,9 @@ const We = function(t) {
412
412
  placement: i,
413
413
  overflows: I
414
414
  }], !I.every((T) => T <= 0)) {
415
- var C, L;
416
- const T = (((C = s.flip) == null ? void 0 : C.index) || 0) + 1, V = R[T];
417
- if (V && (!(a === "alignment" ? y !== F(V) : !1) || // We leave the current main axis only if every placement on that axis
415
+ var S, L;
416
+ const T = (((S = s.flip) == null ? void 0 : S.index) || 0) + 1, z = R[T];
417
+ if (z && (!(a === "alignment" ? y !== F(z) : !1) || // We leave the current main axis only if every placement on that axis
418
418
  // overflows the main axis.
419
419
  x.every((M) => F(M.placement) === y ? M.overflows[0] > 0 : !0)))
420
420
  return {
@@ -423,7 +423,7 @@ const We = function(t) {
423
423
  overflows: x
424
424
  },
425
425
  reset: {
426
- placement: V
426
+ placement: z
427
427
  }
428
428
  };
429
429
  let B = (L = x.filter((A) => A.overflows[0] <= 0).sort((A, M) => A.overflows[1] - M.overflows[1])[0]) == null ? void 0 : L.placement;
@@ -551,22 +551,22 @@ const Ke = function(t) {
551
551
  return a.find((m) => c > m.left - u.left && c < m.right + u.right && p > m.top - u.top && p < m.bottom + u.bottom) || d;
552
552
  if (a.length >= 2) {
553
553
  if (F(n) === "y") {
554
- const x = a[0], C = a[a.length - 1], L = z(n) === "top", H = x.top, T = C.bottom, V = L ? x.left : C.left, B = L ? x.right : C.right, A = B - V, M = T - H;
554
+ const x = a[0], S = a[a.length - 1], L = V(n) === "top", H = x.top, T = S.bottom, z = L ? x.left : S.left, B = L ? x.right : S.right, A = B - z, M = T - H;
555
555
  return {
556
556
  top: H,
557
557
  bottom: T,
558
- left: V,
558
+ left: z,
559
559
  right: B,
560
560
  width: A,
561
561
  height: M,
562
- x: V,
562
+ x: z,
563
563
  y: H
564
564
  };
565
565
  }
566
- const m = z(n) === "left", v = D(...a.map((x) => x.right)), y = K(...a.map((x) => x.left)), w = a.filter((x) => m ? x.left === y : x.right === v), b = w[0].top, S = w[w.length - 1].bottom, O = y, R = v, U = R - O, I = S - b;
566
+ const m = V(n) === "left", v = D(...a.map((x) => x.right)), y = K(...a.map((x) => x.left)), w = a.filter((x) => m ? x.left === y : x.right === v), b = w[0].top, C = w[w.length - 1].bottom, O = y, R = v, U = R - O, I = C - b;
567
567
  return {
568
568
  top: b,
569
- bottom: S,
569
+ bottom: C,
570
570
  left: O,
571
571
  right: R,
572
572
  width: U,
@@ -597,7 +597,7 @@ async function Ye(t, e) {
597
597
  placement: n,
598
598
  platform: o,
599
599
  elements: i
600
- } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = z(n), l = N(n), c = F(n) === "y", p = je.has(r) ? -1 : 1, f = s && c ? -1 : 1, a = j(e, t);
600
+ } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = V(n), l = N(n), c = F(n) === "y", p = je.has(r) ? -1 : 1, f = s && c ? -1 : 1, a = j(e, t);
601
601
  let {
602
602
  mainAxis: d,
603
603
  crossAxis: u,
@@ -670,7 +670,7 @@ const Xe = function(t) {
670
670
  } = j(t, e), f = {
671
671
  x: n,
672
672
  y: o
673
- }, a = await s.detectOverflow(e, p), d = F(z(i)), u = $t(d);
673
+ }, a = await s.detectOverflow(e, p), d = F(V(i)), u = $t(d);
674
674
  let h = f[u], g = f[d];
675
675
  if (r) {
676
676
  const v = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", w = h + a[v], b = h - a[y];
@@ -713,17 +713,17 @@ const Xe = function(t) {
713
713
  apply: c = () => {
714
714
  },
715
715
  ...p
716
- } = j(t, e), f = await r.detectOverflow(e, p), a = z(i), d = N(i), u = F(i) === "y", {
716
+ } = j(t, e), f = await r.detectOverflow(e, p), a = V(i), d = N(i), u = F(i) === "y", {
717
717
  width: h,
718
718
  height: g
719
719
  } = s.floating;
720
720
  let m, v;
721
721
  a === "top" || a === "bottom" ? (m = a, v = d === (await (r.isRTL == null ? void 0 : r.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (v = a, m = d === "end" ? "top" : "bottom");
722
- const y = g - f.top - f.bottom, w = h - f.left - f.right, b = K(g - f[m], y), S = K(h - f[v], w), O = !e.middlewareData.shift;
723
- let R = b, U = S;
722
+ const y = g - f.top - f.bottom, w = h - f.left - f.right, b = K(g - f[m], y), C = K(h - f[v], w), O = !e.middlewareData.shift;
723
+ let R = b, U = C;
724
724
  if ((n = e.middlewareData.shift) != null && n.enabled.x && (U = w), (o = e.middlewareData.shift) != null && o.enabled.y && (R = y), O && !d) {
725
- const x = D(f.left, 0), C = D(f.right, 0), L = D(f.top, 0), H = D(f.bottom, 0);
726
- u ? U = h - 2 * (x !== 0 || C !== 0 ? x + C : D(f.left, f.right)) : R = g - 2 * (L !== 0 || H !== 0 ? L + H : D(f.top, f.bottom));
725
+ const x = D(f.left, 0), S = D(f.right, 0), L = D(f.top, 0), H = D(f.bottom, 0);
726
+ u ? U = h - 2 * (x !== 0 || S !== 0 ? x + S : D(f.left, f.right)) : R = g - 2 * (L !== 0 || H !== 0 ? L + H : D(f.top, f.bottom));
727
727
  }
728
728
  await c({
729
729
  ...e,
@@ -793,7 +793,7 @@ const Je = /transform|translate|scale|rotate|perspective|filter/, Qe = /paint|la
793
793
  let dt;
794
794
  function Ot(t) {
795
795
  const e = _(t) ? W(t) : t;
796
- return Z(e.transform) || Z(e.translate) || Z(e.scale) || Z(e.rotate) || Z(e.perspective) || !St() && (Z(e.backdropFilter) || Z(e.filter)) || Je.test(e.willChange || "") || Qe.test(e.contain || "");
796
+ return Z(e.transform) || Z(e.translate) || Z(e.scale) || Z(e.rotate) || Z(e.perspective) || !Ct() && (Z(e.backdropFilter) || Z(e.filter)) || Je.test(e.willChange || "") || Qe.test(e.contain || "");
797
797
  }
798
798
  function ti(t) {
799
799
  let e = G(t);
@@ -806,7 +806,7 @@ function ti(t) {
806
806
  }
807
807
  return null;
808
808
  }
809
- function St() {
809
+ function Ct() {
810
810
  return dt == null && (dt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), dt;
811
811
  }
812
812
  function tt(t) {
@@ -880,7 +880,7 @@ function J(t) {
880
880
  const ei = /* @__PURE__ */ $(0);
881
881
  function Jt(t) {
882
882
  const e = P(t);
883
- return !St() || !e.visualViewport ? ei : {
883
+ return !Ct() || !e.visualViewport ? ei : {
884
884
  x: e.visualViewport.offsetLeft,
885
885
  y: e.visualViewport.offsetTop
886
886
  };
@@ -968,7 +968,7 @@ function ri(t, e) {
968
968
  let s = o.clientWidth, r = o.clientHeight, l = 0, c = 0;
969
969
  if (i) {
970
970
  s = i.width, r = i.height;
971
- const f = St();
971
+ const f = Ct();
972
972
  (!f || f && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
973
973
  }
974
974
  const p = ft(o);
@@ -1145,7 +1145,7 @@ const pi = {
1145
1145
  ...i.platform,
1146
1146
  _c: o
1147
1147
  };
1148
- return Ve(t, e, {
1148
+ return ze(t, e, {
1149
1149
  ...i,
1150
1150
  platform: s
1151
1151
  });
@@ -1219,10 +1219,10 @@ var mi = class {
1219
1219
  this.hide();
1220
1220
  return;
1221
1221
  }
1222
- this.updatePosition(), this.show();
1222
+ this.show(), this.updatePosition();
1223
1223
  }, this.transactionHandler = ({ transaction: a }) => {
1224
1224
  const d = a.getMeta(this.pluginKey);
1225
- d === "updatePosition" ? this.updatePosition() : d && typeof d == "object" && d.type === "updateOptions" && this.updateOptions(d.options);
1225
+ d === "updatePosition" ? this.updatePosition() : d && typeof d == "object" && d.type === "updateOptions" ? this.updateOptions(d.options) : d === "hide" ? this.hide() : d === "show" && (this.updatePosition(), this.show());
1226
1226
  };
1227
1227
  var f;
1228
1228
  this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (f = p?.scrollTarget) != null ? f : window, this.getReferencedVirtualElement = c, this.floatingUIOptions = {
@@ -1251,7 +1251,7 @@ var mi = class {
1251
1251
  return i;
1252
1252
  if (!((n = (e = this.view) == null ? void 0 : e.dom) != null && n.parentNode))
1253
1253
  return;
1254
- const s = Vt(this.view, o.from, o.to);
1254
+ const s = zt(this.view, o.from, o.to);
1255
1255
  let r = {
1256
1256
  getBoundingClientRect: () => s,
1257
1257
  getClientRects: () => [s]
@@ -1280,6 +1280,8 @@ var mi = class {
1280
1280
  return r;
1281
1281
  }
1282
1282
  updatePosition() {
1283
+ if (!this.isVisible)
1284
+ return;
1283
1285
  const t = this.virtualElement;
1284
1286
  t && ue(t, this.element, {
1285
1287
  placement: this.floatingUIOptions.placement,
@@ -1287,11 +1289,13 @@ var mi = class {
1287
1289
  middleware: this.middlewares
1288
1290
  }).then(({ x: e, y: n, strategy: o, middlewareData: i }) => {
1289
1291
  var s, r;
1290
- if ((s = i.hide) != null && s.referenceHidden || (r = i.hide) != null && r.escaped) {
1291
- this.element.style.visibility = "hidden";
1292
- return;
1292
+ if (!(!this.isVisible || this.editor.isDestroyed || !this.element.isConnected)) {
1293
+ if ((s = i.hide) != null && s.referenceHidden || (r = i.hide) != null && r.escaped) {
1294
+ this.element.style.visibility = "hidden";
1295
+ return;
1296
+ }
1297
+ this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = o, this.element.style.left = `${e}px`, this.element.style.top = `${n}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1293
1298
  }
1294
- this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = o, this.element.style.left = `${e}px`, this.element.style.top = `${n}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1295
1299
  });
1296
1300
  }
1297
1301
  update(t, e) {
@@ -1340,7 +1344,7 @@ var mi = class {
1340
1344
  destroy() {
1341
1345
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
1342
1346
  }
1343
- }, fe = (t) => new zt({
1347
+ }, fe = (t) => new Vt({
1344
1348
  key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
1345
1349
  view: (e) => new mi({ view: e, ...t })
1346
1350
  });
@@ -1418,7 +1422,7 @@ var wi = class {
1418
1422
  f?.relatedTarget && ((a = this.element.parentNode) != null && a.contains(f.relatedTarget)) || f?.relatedTarget !== this.editor.view.dom && this.hide();
1419
1423
  }, this.transactionHandler = ({ transaction: f }) => {
1420
1424
  const a = f.getMeta(this.pluginKey);
1421
- a === "updatePosition" ? this.updatePosition() : a && typeof a == "object" && a.type === "updateOptions" && this.updateOptions(a.options);
1425
+ a === "updatePosition" ? this.updatePosition() : a && typeof a == "object" && a.type === "updateOptions" ? this.updateOptions(a.options) : a === "hide" ? this.hide() : a === "show" && (this.updatePosition(), this.show());
1422
1426
  }, this.resizeHandler = () => {
1423
1427
  this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
1424
1428
  this.updatePosition();
@@ -1431,7 +1435,7 @@ var wi = class {
1431
1435
  }, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
1432
1436
  }
1433
1437
  getTextContent(t) {
1434
- return Se(t, { textSerializers: Ce(this.editor.schema) });
1438
+ return Ce(t, { textSerializers: Se(this.editor.schema) });
1435
1439
  }
1436
1440
  get middlewares() {
1437
1441
  const t = [];
@@ -1470,7 +1474,7 @@ var wi = class {
1470
1474
  }
1471
1475
  }
1472
1476
  updatePosition() {
1473
- const { selection: t } = this.editor.state, e = Vt(this.view, t.from, t.to);
1477
+ const { selection: t } = this.editor.state, e = zt(this.view, t.from, t.to);
1474
1478
  ue({
1475
1479
  getBoundingClientRect: () => e,
1476
1480
  getClientRects: () => [e]
@@ -1505,7 +1509,7 @@ var wi = class {
1505
1509
  destroy() {
1506
1510
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
1507
1511
  }
1508
- }, de = (t) => new zt({
1512
+ }, de = (t) => new Vt({
1509
1513
  key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
1510
1514
  view: (e) => new wi({ view: e, ...t })
1511
1515
  });
@@ -1599,7 +1603,7 @@ var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "o
1599
1603
  "tabIndex",
1600
1604
  "title",
1601
1605
  "translate"
1602
- ]), Si = {
1606
+ ]), Ci = {
1603
1607
  Blur: "focusout",
1604
1608
  DoubleClick: "dblclick",
1605
1609
  Focus: "focusin",
@@ -1609,7 +1613,7 @@ var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "o
1609
1613
  function wt(t, e) {
1610
1614
  return /^on[A-Z]/.test(t) && typeof e == "function";
1611
1615
  }
1612
- function Ci(t) {
1616
+ function Si(t) {
1613
1617
  return t.startsWith("aria-") || t.startsWith("data-"), t;
1614
1618
  }
1615
1619
  function Ti(t) {
@@ -1622,7 +1626,7 @@ function Ei(t) {
1622
1626
  var e;
1623
1627
  const n = t.endsWith("Capture"), i = (n ? t.slice(0, -7) : t).slice(2);
1624
1628
  return {
1625
- eventName: (e = Si[i]) != null ? e : i.toLowerCase(),
1629
+ eventName: (e = Ci[i]) != null ? e : i.toLowerCase(),
1626
1630
  options: n ? { capture: !0 } : void 0
1627
1631
  };
1628
1632
  }
@@ -1691,7 +1695,7 @@ function Ai(t, e, n) {
1691
1695
  const s = e[i], r = n[i];
1692
1696
  if (s === r)
1693
1697
  return;
1694
- const l = Ci(i);
1698
+ const l = Si(i);
1695
1699
  if (r == null || r === !1) {
1696
1700
  pt(i) && Ii(t, i), t.removeAttribute(l);
1697
1701
  return;
@@ -1789,12 +1793,12 @@ var Bi = _t.forwardRef(
1789
1793
  }
1790
1794
  const b = a.current;
1791
1795
  b.style.visibility = "hidden", b.style.position = "absolute";
1792
- const S = fe({
1796
+ const C = fe({
1793
1797
  ...m.current,
1794
1798
  editor: h,
1795
1799
  element: b
1796
1800
  });
1797
- h.registerPlugin(S);
1801
+ h.registerPlugin(C);
1798
1802
  const O = m.current.pluginKey;
1799
1803
  return w.current = !0, y(!0), () => {
1800
1804
  y(!1), h.unregisterPlugin(O), window.requestAnimationFrame(() => {
@@ -1858,9 +1862,9 @@ _t.forwardRef(
1858
1862
  element: w
1859
1863
  });
1860
1864
  u.registerPlugin(b);
1861
- const S = g.current.pluginKey;
1865
+ const C = g.current.pluginKey;
1862
1866
  return y.current = !0, v(!0), () => {
1863
- v(!1), u.unregisterPlugin(S), window.requestAnimationFrame(() => {
1867
+ v(!1), u.unregisterPlugin(C), window.requestAnimationFrame(() => {
1864
1868
  w.parentNode && w.parentNode.removeChild(w);
1865
1869
  });
1866
1870
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
2
  import { Flex as a, Button as r } from "@radix-ui/themes";
3
- import { u } from "../../../index-PJNQPLn5.js";
3
+ import { u } from "../../../index-DxF-1P4n.js";
4
4
  import { useCallback as c } from "react";
5
5
  const p = ({ editor: e }) => {
6
6
  const i = u({
@@ -1,5 +1,5 @@
1
1
  import { t as i } from "../../../../tippy.esm-DLHdsnfG.js";
2
- import { R as a } from "../../../../index-PJNQPLn5.js";
2
+ import { R as a } from "../../../../index-DxF-1P4n.js";
3
3
  import { getPopupMountTarget as s } from "../getPopupMountTarget.js";
4
4
  import { EmojiList as c } from "./EmojiList.js";
5
5
  const u = () => ({
@@ -1,4 +1,4 @@
1
- import { a as f } from "../../../extension-link-D3eyOFkn.js";
1
+ import { a as f } from "../../../extension-link-Ch_T7WWG.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,5 +1,5 @@
1
- import { P as d, a as u, b as f } from "../../../index-hHvpW2H6.js";
2
- import { m as h, g as m } from "../../../markdown-to-html-BwS08CTi.js";
1
+ import { P as d, a as u, b as f } from "../../../index-BiBV5TQx.js";
2
+ import { m as h, g as m } from "../../../markdown-to-html-pL7ckd-m.js";
3
3
  const p = new d("markdownPaste"), k = /* @__PURE__ */ new Set(["blockquote", "code", "heading", "hr", "list", "table"]), y = /* @__PURE__ */ new Set(["codespan", "del", "em", "strong"]), T = (e) => e.type === "image" ? e.raw.startsWith("![") : e.type === "link" ? e.raw.startsWith("[") : !1, i = (e) => e.some((t) => k.has(t.type) || y.has(t.type) || T(t) || "tokens" in t && Array.isArray(t.tokens) && i(t.tokens) ? !0 : "items" in t && Array.isArray(t.items) ? t.items.some((s) => i(s.tokens)) : !1), b = (e) => {
4
4
  const t = e.trim();
5
5
  return t ? i(m.lexer(t)) : !1;
@@ -1,4 +1,4 @@
1
- import { a as o } from "../../../index-hHvpW2H6.js";
1
+ import { a as o } from "../../../index-BiBV5TQx.js";
2
2
  const s = o.create({
3
3
  name: "SelectedText",
4
4
  addCommands: () => ({
@@ -1,3 +1,17 @@
1
- import { ScribeProps } from "..";
2
- export declare const initExtensions: (props: ScribeProps) => (import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-focus").FocusOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Extension<import("@tiptap/extension-mathematics").MathematicsOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any>)[];
1
+ import type { ScribeProps } from "..";
2
+ export declare const initExtensions: (props: ScribeProps) => (import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Extension<{
3
+ anchorTypes: string[];
4
+ onUpdate?: import("./tableOfContents").ScribeTableOfContentsChangeHandler;
5
+ }, {
6
+ anchors: HTMLElement[];
7
+ content: import("./tableOfContents").ScribeTableOfContentsItem[];
8
+ hasCreated: boolean;
9
+ lastSignature: string;
10
+ rafId: number | null;
11
+ refresh: () => void;
12
+ scheduleRefresh: () => void;
13
+ scrollHandler: () => void;
14
+ scrollParent: (HTMLElement | Window) | null;
15
+ updateScrollParent: () => void;
16
+ }> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-placeholder").PlaceholderOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-focus").FocusOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Extension<import("@tiptap/extension-mathematics").MathematicsOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any>)[];
3
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAoBjC,eAAO,MAAM,cAAc,GAAI,OAAO,WAAW,0pCA4DhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAqBtC,eAAO,MAAM,cAAc,GAAI,OAAO,WAAW;;;;;;;;;;;;;;2hCAmEhD,CAAC"}