@clevertask/scribe 0.1.20 → 0.1.21

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 (45) hide show
  1. package/dist/{BarMenu-sZGqMjQr.js → BarMenu-tPZoiOba.js} +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.js +1 -1
  4. package/dist/components/Menu/BubbleMenu.js +2 -2
  5. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  6. package/dist/components/Menu/LinkBubbleMenu.js +6 -6
  7. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  8. package/dist/components/Menu/TableBubbleMenu.js +2 -2
  9. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  10. package/dist/components/Scribe/extension/callout.js +1 -1
  11. package/dist/components/Scribe/extension/emoji/suggest.js +3 -3
  12. package/dist/components/Scribe/extension/extension-link.js +1 -1
  13. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  14. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  15. package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
  16. package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
  18. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  19. package/dist/components/Scribe/extension/external-link-preview/resolver.js +1 -1
  20. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  21. package/dist/components/Scribe/extension/index.js +1 -1
  22. package/dist/components/Scribe/extension/resizable-table.js +1 -1
  23. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +2 -2
  24. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  25. package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
  26. package/dist/components/Scribe/extension/tableOfContents.js +3 -3
  27. package/dist/components/Scribe/index.js +4 -4
  28. package/dist/{dist-Bm6rBIf2.js → dist-Cer8ra_P.js} +2 -2
  29. package/dist/{dist-jjH04EIX.js → dist-ClNucvAM.js} +441 -435
  30. package/dist/{dist-BrbZZTdj.js → dist-D31OwZrM.js} +212 -161
  31. package/dist/{extension-BNjzWzJi.js → extension-B-7qHi2u.js} +2 -2
  32. package/dist/{extension-link-7ta0X4tP.js → extension-link-BQrkQZHi.js} +23 -23
  33. package/dist/{html-to-markdown-pY8ngCXa.js → html-to-markdown-D7PT8MhP.js} +1 -1
  34. package/dist/main.js +2 -2
  35. package/dist/{markdown-to-html-BSuSwB4B.js → markdown-to-html-ChfR7P_Y.js} +3 -3
  36. package/dist/{menus-i0cEakC3.js → menus-DLKcWlVX.js} +34 -34
  37. package/dist/{resizable-table-DFTyMlVu.js → resizable-table-DgMCiXeO.js} +3 -3
  38. package/dist/{schema-extensions-B-U6SbYg.js → schema-extensions-BMJIwh-u.js} +137 -137
  39. package/dist/schema-extensions.js +1 -1
  40. package/dist/schema.js +1 -1
  41. package/dist/{tippy.esm-DOXqN1Qm.js → tippy.esm-8vSV0zL7.js} +6 -6
  42. package/dist/utils/html-to-markdown.js +1 -1
  43. package/dist/utils/index.js +4 -4
  44. package/dist/utils/markdown-to-html.js +1 -1
  45. package/package.json +56 -53
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
2
- import { C as t, N as n, o as r, t as i } from "./dist-jjH04EIX.js";
2
+ import { C as t, N as n, o as r, t as i } from "./dist-ClNucvAM.js";
3
3
  import * as a from "react";
4
4
  import o, { createContext as s, createElement as c, createRef as l, forwardRef as u, memo as d, useContext as f, useDebugValue as p, useEffect as m, useLayoutEffect as h, useMemo as g, useRef as _, useState as v, version as y } from "react";
5
5
  import b, { flushSync as ee } from "react-dom";
@@ -7,7 +7,7 @@ import { Fragment as x, jsx as S, jsxs as te } from "react/jsx-runtime";
7
7
  //#region builtin:esm-external-require-react
8
8
  var C = /* @__PURE__ */ e(((e, t) => {
9
9
  t.exports = { ...a };
10
- })), w = /* @__PURE__ */ e(((e) => {
10
+ })), ne = /* @__PURE__ */ e(((e) => {
11
11
  var t = C();
12
12
  function n(e, t) {
13
13
  return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
@@ -45,7 +45,7 @@ var C = /* @__PURE__ */ e(((e, t) => {
45
45
  }
46
46
  var d = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? u : c;
47
47
  e.useSyncExternalStore = t.useSyncExternalStore === void 0 ? d : t.useSyncExternalStore;
48
- })), ne = /* @__PURE__ */ e(((e) => {
48
+ })), re = /* @__PURE__ */ e(((e) => {
49
49
  process.env.NODE_ENV !== "production" && (function() {
50
50
  function t(e, t) {
51
51
  return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
@@ -91,15 +91,15 @@ var C = /* @__PURE__ */ e(((e, t) => {
91
91
  var a = C(), o = typeof Object.is == "function" ? Object.is : t, s = a.useState, c = a.useEffect, l = a.useLayoutEffect, u = a.useDebugValue, d = !1, f = !1, p = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? i : n;
92
92
  e.useSyncExternalStore = a.useSyncExternalStore === void 0 ? p : a.useSyncExternalStore, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
93
93
  })();
94
- })), T = /* @__PURE__ */ e(((e, t) => {
95
- t.exports = process.env.NODE_ENV === "production" ? w() : ne();
96
- })), E = T(), { getOwnPropertyNames: re, getOwnPropertySymbols: ie } = Object, { hasOwnProperty: ae } = Object.prototype;
97
- function D(e, t) {
94
+ })), w = /* @__PURE__ */ e(((e, t) => {
95
+ t.exports = process.env.NODE_ENV === "production" ? ne() : re();
96
+ })), T = w(), { getOwnPropertyNames: ie, getOwnPropertySymbols: ae } = Object, { hasOwnProperty: oe } = Object.prototype;
97
+ function E(e, t) {
98
98
  return function(n, r, i) {
99
99
  return e(n, r, i) && t(n, r, i);
100
100
  };
101
101
  }
102
- function O(e) {
102
+ function D(e) {
103
103
  return function(t, n, r) {
104
104
  if (!t || !n || typeof t != "object" || typeof n != "object") return e(t, n, r);
105
105
  let { cache: i } = r, a = i.get(t), o = i.get(n);
@@ -109,36 +109,36 @@ function O(e) {
109
109
  return i.delete(t), i.delete(n), s;
110
110
  };
111
111
  }
112
- function oe(e) {
112
+ function se(e) {
113
113
  return e?.[Symbol.toStringTag];
114
114
  }
115
- function k(e) {
116
- return re(e).concat(ie(e));
115
+ function O(e) {
116
+ return ie(e).concat(ae(e));
117
117
  }
118
- var se = Object.hasOwn || ((e, t) => ae.call(e, t));
119
- function A(e, t) {
118
+ var ce = Object.hasOwn || ((e, t) => oe.call(e, t));
119
+ function k(e, t) {
120
120
  return e === t || !e && !t && e !== e && t !== t;
121
121
  }
122
- var ce = "__v", le = "__o", ue = "_owner", { getOwnPropertyDescriptor: j, keys: M } = Object;
123
- function de(e, t) {
124
- return e.byteLength === t.byteLength && R(new Uint8Array(e), new Uint8Array(t));
122
+ var le = "__v", ue = "__o", de = "_owner", fe = typeof Float16Array < "u", { getOwnPropertyDescriptor: A, keys: j } = Object;
123
+ function pe(e, t) {
124
+ return e.byteLength === t.byteLength && L(new Uint8Array(e), new Uint8Array(t));
125
125
  }
126
- function fe(e, t, n) {
126
+ function me(e, t, n) {
127
127
  let r = e.length;
128
128
  if (t.length !== r) return !1;
129
129
  for (; r-- > 0;) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1;
130
130
  return !0;
131
131
  }
132
- function pe(e, t) {
133
- return e.byteLength === t.byteLength && R(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
134
- }
135
- function me(e, t) {
136
- return A(e.getTime(), t.getTime());
137
- }
138
132
  function he(e, t) {
139
- return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
133
+ return e.byteLength === t.byteLength && L(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
140
134
  }
141
135
  function ge(e, t) {
136
+ return k(e.getTime(), t.getTime());
137
+ }
138
+ function M(e, t, n) {
139
+ return e.name === t.name && e.message === t.message && e.stack === t.stack && n.equals(e.cause, t.cause, "cause", "cause", e, t, n);
140
+ }
141
+ function _e(e, t) {
142
142
  return e === t;
143
143
  }
144
144
  function N(e, t, n) {
@@ -165,27 +165,27 @@ function N(e, t, n) {
165
165
  }
166
166
  return !0;
167
167
  }
168
- var _e = A;
168
+ var ve = k;
169
169
  function P(e, t, n) {
170
- let r = M(e), i = r.length;
171
- if (M(t).length !== i) return !1;
170
+ let r = j(e), i = r.length;
171
+ if (j(t).length !== i) return !1;
172
172
  for (; i-- > 0;) if (!z(e, t, n, r[i])) return !1;
173
173
  return !0;
174
174
  }
175
175
  function F(e, t, n) {
176
- let r = k(e), i = r.length;
177
- if (k(t).length !== i) return !1;
176
+ let r = O(e), i = r.length;
177
+ if (O(t).length !== i) return !1;
178
178
  let a, o, s;
179
- for (; i-- > 0;) if (a = r[i], !z(e, t, n, a) || (o = j(e, a), s = j(t, a), (o || s) && (!o || !s || o.configurable !== s.configurable || o.enumerable !== s.enumerable || o.writable !== s.writable))) return !1;
179
+ for (; i-- > 0;) if (a = r[i], !z(e, t, n, a) || (o = A(e, a), s = A(t, a), (o || s) && (!o || !s || o.configurable !== s.configurable || o.enumerable !== s.enumerable || o.writable !== s.writable))) return !1;
180
180
  return !0;
181
181
  }
182
- function I(e, t) {
183
- return A(e.valueOf(), t.valueOf());
182
+ function ye(e, t) {
183
+ return k(e.valueOf(), t.valueOf());
184
184
  }
185
- function ve(e, t) {
185
+ function be(e, t) {
186
186
  return e.source === t.source && e.flags === t.flags;
187
187
  }
188
- function L(e, t, n) {
188
+ function I(e, t, n) {
189
189
  let r = e.size;
190
190
  if (r !== t.size) return !1;
191
191
  if (!r) return !0;
@@ -203,19 +203,30 @@ function L(e, t, n) {
203
203
  }
204
204
  return !0;
205
205
  }
206
- function R(e, t) {
207
- let n = e.byteLength;
208
- if (t.byteLength !== n || e.byteOffset !== t.byteOffset) return !1;
206
+ function L(e, t) {
207
+ let n = e.length;
208
+ if (t.length !== n || e.byteOffset !== t.byteOffset) return !1;
209
+ if (e instanceof Float64Array || e instanceof Float32Array || fe && e instanceof Float16Array) {
210
+ for (; n-- > 0;) if (e[n] !== t[n] && (e[n] === e[n] || t[n] === t[n])) return !1;
211
+ return !0;
212
+ }
209
213
  for (; n-- > 0;) if (e[n] !== t[n]) return !1;
210
214
  return !0;
211
215
  }
212
- function ye(e, t) {
213
- return e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password;
216
+ function xe(e, t) {
217
+ return e.href === t.href || e.protocol === t.protocol && e.username === t.username && e.password === t.password && e.host === t.host && e.pathname === t.pathname && e.hash === t.hash && Se(e.searchParams, t.searchParams);
218
+ }
219
+ function Se(e, t) {
220
+ let n = e.toString(), r = t.toString();
221
+ return n === r || R(n) === R(r);
222
+ }
223
+ function R(e) {
224
+ return e.split("&").sort().join("&");
214
225
  }
215
226
  function z(e, t, n, r) {
216
- return (r === ue || r === le || r === ce) && (e.$$typeof || t.$$typeof) ? !0 : se(t, r) && n.equals(e[r], t[r], r, r, e, t, n);
227
+ return (r === de || r === ue || r === le) && (e.$$typeof || t.$$typeof) ? !0 : ce(t, r) && n.equals(e[r], t[r], r, r, e, t, n);
217
228
  }
218
- var be = "[object ArrayBuffer]", xe = "[object Arguments]", Se = "[object Boolean]", Ce = "[object DataView]", we = "[object Date]", Te = "[object Error]", Ee = "[object Map]", De = "[object Number]", Oe = "[object Object]", ke = "[object RegExp]", Ae = "[object Set]", je = "[object String]", Me = {
229
+ var Ce = "[object ArrayBuffer]", we = "[object Arguments]", Te = "[object Boolean]", Ee = "[object DataView]", De = "[object Date]", Oe = "[object Error]", ke = "[object Map]", Ae = "[object Number]", je = "[object Object]", Me = "[object RegExp]", Ne = "[object Set]", Pe = "[object String]", Fe = {
219
230
  "[object Int8Array]": !0,
220
231
  "[object Uint8Array]": !0,
221
232
  "[object Uint8ClampedArray]": !0,
@@ -228,8 +239,8 @@ var be = "[object ArrayBuffer]", xe = "[object Arguments]", Se = "[object Boolea
228
239
  "[object Float64Array]": !0,
229
240
  "[object BigInt64Array]": !0,
230
241
  "[object BigUint64Array]": !0
231
- }, Ne = "[object URL]", Pe = Object.prototype.toString;
232
- function Fe({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n, areDatesEqual: r, areErrorsEqual: i, areFunctionsEqual: a, areMapsEqual: o, areNumbersEqual: s, areObjectsEqual: c, arePrimitiveWrappersEqual: l, areRegExpsEqual: u, areSetsEqual: d, areTypedArraysEqual: f, areUrlsEqual: p, unknownTagComparators: m }) {
242
+ }, Ie = "[object URL]", Le = Object.prototype.toString;
243
+ function Re({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n, areDatesEqual: r, areErrorsEqual: i, areFunctionsEqual: a, areMapsEqual: o, areNumbersEqual: s, areObjectsEqual: c, arePrimitiveWrappersEqual: l, areRegExpsEqual: u, areSetsEqual: d, areTypedArraysEqual: f, areUrlsEqual: p, unknownTagComparators: m }) {
233
244
  return function(h, g, _) {
234
245
  if (h === g) return !0;
235
246
  if (h == null || g == null) return !1;
@@ -244,23 +255,23 @@ function Fe({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
244
255
  if (y === RegExp) return u(h, g, _);
245
256
  if (y === Map) return o(h, g, _);
246
257
  if (y === Set) return d(h, g, _);
247
- let b = Pe.call(h);
248
- if (b === we) return r(h, g, _);
249
- if (b === ke) return u(h, g, _);
250
- if (b === Ee) return o(h, g, _);
251
- if (b === Ae) return d(h, g, _);
252
- if (b === Oe) return typeof h.then != "function" && typeof g.then != "function" && c(h, g, _);
253
- if (b === Ne) return p(h, g, _);
254
- if (b === Te) return i(h, g, _);
255
- if (b === xe) return c(h, g, _);
256
- if (Me[b]) return f(h, g, _);
257
- if (b === be) return e(h, g, _);
258
- if (b === Ce) return n(h, g, _);
259
- if (b === Se || b === De || b === je) return l(h, g, _);
258
+ let b = Le.call(h);
259
+ if (b === De) return r(h, g, _);
260
+ if (b === Me) return u(h, g, _);
261
+ if (b === ke) return o(h, g, _);
262
+ if (b === Ne) return d(h, g, _);
263
+ if (b === je) return typeof h.then != "function" && typeof g.then != "function" && c(h, g, _);
264
+ if (b === Ie) return p(h, g, _);
265
+ if (b === Oe) return i(h, g, _);
266
+ if (b === we) return c(h, g, _);
267
+ if (Fe[b]) return f(h, g, _);
268
+ if (b === Ce) return e(h, g, _);
269
+ if (b === Ee) return n(h, g, _);
270
+ if (b === Te || b === Ae || b === Pe) return l(h, g, _);
260
271
  if (m) {
261
272
  let e = m[b];
262
273
  if (!e) {
263
- let t = oe(h);
274
+ let t = se(h);
264
275
  t && (e = m[t]);
265
276
  }
266
277
  if (e) return e(h, g, _);
@@ -268,41 +279,42 @@ function Fe({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
268
279
  return !1;
269
280
  };
270
281
  }
271
- function Ie({ circular: e, createCustomConfig: t, strict: n }) {
282
+ function ze({ circular: e, createCustomConfig: t, strict: n }) {
272
283
  let r = {
273
- areArrayBuffersEqual: de,
274
- areArraysEqual: n ? F : fe,
275
- areDataViewsEqual: pe,
276
- areDatesEqual: me,
277
- areErrorsEqual: he,
278
- areFunctionsEqual: ge,
279
- areMapsEqual: n ? D(N, F) : N,
280
- areNumbersEqual: _e,
284
+ areArrayBuffersEqual: pe,
285
+ areArraysEqual: n ? F : me,
286
+ areDataViewsEqual: he,
287
+ areDatesEqual: ge,
288
+ areErrorsEqual: n ? E(M, F) : E(M, P),
289
+ areFunctionsEqual: _e,
290
+ areMapsEqual: n ? E(N, F) : N,
291
+ areNumbersEqual: ve,
281
292
  areObjectsEqual: n ? F : P,
282
- arePrimitiveWrappersEqual: I,
283
- areRegExpsEqual: ve,
284
- areSetsEqual: n ? D(L, F) : L,
285
- areTypedArraysEqual: n ? D(R, F) : R,
286
- areUrlsEqual: ye,
293
+ arePrimitiveWrappersEqual: ye,
294
+ areRegExpsEqual: be,
295
+ areSetsEqual: n ? E(I, F) : I,
296
+ areTypedArraysEqual: n ? E(L, F) : L,
297
+ areUrlsEqual: xe,
287
298
  unknownTagComparators: void 0
288
299
  };
289
300
  if (t && (r = Object.assign({}, r, t(r))), e) {
290
- let e = O(r.areArraysEqual), t = O(r.areMapsEqual), n = O(r.areObjectsEqual), i = O(r.areSetsEqual);
301
+ let e = D(r.areArraysEqual), t = D(r.areErrorsEqual), n = D(r.areMapsEqual), i = D(r.areObjectsEqual), a = D(r.areSetsEqual);
291
302
  r = Object.assign({}, r, {
292
303
  areArraysEqual: e,
293
- areMapsEqual: t,
294
- areObjectsEqual: n,
295
- areSetsEqual: i
304
+ areErrorsEqual: t,
305
+ areMapsEqual: n,
306
+ areObjectsEqual: i,
307
+ areSetsEqual: a
296
308
  });
297
309
  }
298
310
  return r;
299
311
  }
300
- function Le(e) {
312
+ function Be(e) {
301
313
  return function(t, n, r, i, a, o, s) {
302
314
  return e(t, n, s);
303
315
  };
304
316
  }
305
- function Re({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
317
+ function Ve({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
306
318
  if (n) return function(a, o) {
307
319
  let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
308
320
  return t(a, o, {
@@ -330,35 +342,35 @@ function Re({ circular: e, comparator: t, createState: n, equals: r, strict: i }
330
342
  return t(e, n, a);
331
343
  };
332
344
  }
333
- var ze = B();
345
+ var He = B();
334
346
  B({ strict: !0 }), B({ circular: !0 }), B({
335
347
  circular: !0,
336
348
  strict: !0
337
- }), B({ createInternalComparator: () => A }), B({
349
+ }), B({ createInternalComparator: () => k }), B({
338
350
  strict: !0,
339
- createInternalComparator: () => A
351
+ createInternalComparator: () => k
340
352
  }), B({
341
353
  circular: !0,
342
- createInternalComparator: () => A
354
+ createInternalComparator: () => k
343
355
  }), B({
344
356
  circular: !0,
345
- createInternalComparator: () => A,
357
+ createInternalComparator: () => k,
346
358
  strict: !0
347
359
  });
348
360
  function B(e = {}) {
349
- let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = Fe(Ie(e));
350
- return Re({
361
+ let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = Re(ze(e));
362
+ return Ve({
351
363
  circular: t,
352
364
  comparator: a,
353
365
  createState: r,
354
- equals: n ? n(a) : Le(a),
366
+ equals: n ? n(a) : Be(a),
355
367
  strict: i
356
368
  });
357
369
  }
358
370
  //#endregion
359
371
  //#region node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.5/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js
360
- var Be = /* @__PURE__ */ e(((e) => {
361
- var t = C(), n = T();
372
+ var Ue = /* @__PURE__ */ e(((e) => {
373
+ var t = C(), n = w();
362
374
  function r(e, t) {
363
375
  return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
364
376
  }
@@ -402,13 +414,13 @@ var Be = /* @__PURE__ */ e(((e) => {
402
414
  f.hasValue = !0, f.value = p;
403
415
  }, [p]), l(p), p;
404
416
  };
405
- })), Ve = /* @__PURE__ */ e(((e) => {
417
+ })), We = /* @__PURE__ */ e(((e) => {
406
418
  process.env.NODE_ENV !== "production" && (function() {
407
419
  function t(e, t) {
408
420
  return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
409
421
  }
410
422
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
411
- var n = C(), r = T(), i = typeof Object.is == "function" ? Object.is : t, a = r.useSyncExternalStore, o = n.useRef, s = n.useEffect, c = n.useMemo, l = n.useDebugValue;
423
+ var n = C(), r = w(), i = typeof Object.is == "function" ? Object.is : t, a = r.useSyncExternalStore, o = n.useRef, s = n.useEffect, c = n.useMemo, l = n.useDebugValue;
412
424
  e.useSyncExternalStoreWithSelector = function(e, t, n, r, u) {
413
425
  var d = o(null);
414
426
  if (d.current === null) {
@@ -449,19 +461,19 @@ var Be = /* @__PURE__ */ e(((e) => {
449
461
  }, [p]), l(p), p;
450
462
  }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
451
463
  })();
452
- })), He = (/* @__PURE__ */ e(((e, t) => {
453
- t.exports = process.env.NODE_ENV === "production" ? Be() : Ve();
454
- })))(), Ue = (...e) => (t) => {
464
+ })), Ge = (/* @__PURE__ */ e(((e, t) => {
465
+ t.exports = process.env.NODE_ENV === "production" ? Ue() : We();
466
+ })))(), Ke = (...e) => (t) => {
455
467
  e.forEach((e) => {
456
468
  typeof e == "function" ? e(t) : e && (e.current = t);
457
469
  });
458
- }, We = ({ contentComponent: e }) => {
459
- let t = (0, E.useSyncExternalStore)(e.subscribe, e.getSnapshot, e.getServerSnapshot);
470
+ }, qe = ({ contentComponent: e }) => {
471
+ let t = (0, T.useSyncExternalStore)(e.subscribe, e.getSnapshot, e.getServerSnapshot);
460
472
  return /* @__PURE__ */ S(x, { children: Object.values(t) });
461
473
  };
462
- function Ge() {
474
+ function Je() {
463
475
  let e = /* @__PURE__ */ new Set(), t = {}, n = !1, r = () => {
464
- n || !e.size || (n = !0, queueMicrotask(() => {
476
+ !n && e.size && (n = !0, queueMicrotask(() => {
465
477
  n = !1, e.forEach((e) => e());
466
478
  }));
467
479
  };
@@ -489,7 +501,7 @@ function Ge() {
489
501
  }
490
502
  };
491
503
  }
492
- var Ke = class extends o.Component {
504
+ var Ye = class extends o.Component {
493
505
  constructor(e) {
494
506
  super(e), this.editorContentRef = o.createRef();
495
507
  }
@@ -504,7 +516,7 @@ var Ke = class extends o.Component {
504
516
  if (e && !e.isDestroyed && e.view.dom?.parentNode) {
505
517
  if (e.contentComponent) return;
506
518
  let t = this.editorContentRef.current;
507
- t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent = Ge(), e.createNodeViews(), e.isEditorContentInitialized = !0, this.forceUpdate();
519
+ t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent = Je(), e.createNodeViews(), e.isEditorContentInitialized = !0, this.forceUpdate();
508
520
  }
509
521
  }
510
522
  componentWillUnmount() {
@@ -521,18 +533,18 @@ var Ke = class extends o.Component {
521
533
  render() {
522
534
  let { editor: e, innerRef: t, ...n } = this.props;
523
535
  return /* @__PURE__ */ te(x, { children: [/* @__PURE__ */ S("div", {
524
- ref: Ue(t, this.editorContentRef),
536
+ ref: Ke(t, this.editorContentRef),
525
537
  ...n
526
- }), e?.contentComponent && /* @__PURE__ */ S(We, { contentComponent: e.contentComponent })] });
538
+ }), e?.contentComponent && /* @__PURE__ */ S(qe, { contentComponent: e.contentComponent })] });
527
539
  }
528
- }, qe = u((e, t) => {
540
+ }, Xe = u((e, t) => {
529
541
  let n = o.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
530
- return o.createElement(Ke, {
542
+ return o.createElement(Ye, {
531
543
  key: n,
532
544
  innerRef: t,
533
545
  ...e
534
546
  });
535
- }), V = o.memo(qe), Je = typeof window < "u" ? h : m, Ye = class {
547
+ }), V = o.memo(Xe), Ze = typeof window < "u" ? h : m, Qe = class {
536
548
  constructor(e) {
537
549
  this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = {
538
550
  editor: e,
@@ -568,10 +580,10 @@ var Ke = class extends o.Component {
568
580
  }
569
581
  };
570
582
  function H(e) {
571
- let [t] = v(() => new Ye(e.editor)), n = (0, He.useSyncExternalStoreWithSelector)(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn ?? ze);
572
- return Je(() => t.watch(e.editor), [e.editor, t]), p(n), n;
583
+ let [t] = v(() => new Qe(e.editor)), n = (0, Ge.useSyncExternalStoreWithSelector)(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn ?? He);
584
+ return Ze(() => t.watch(e.editor), [e.editor, t]), p(n), n;
573
585
  }
574
- var U = process.env.NODE_ENV !== "production", W = typeof window > "u", Xe = W || !!(typeof window < "u" && window.next), Ze = class e {
586
+ var U = process.env.NODE_ENV !== "production", W = typeof window > "u", $e = W || !!(typeof window < "u" && window.next), et = class e {
575
587
  constructor(e) {
576
588
  this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = e, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
577
589
  }
@@ -580,7 +592,7 @@ var U = process.env.NODE_ENV !== "production", W = typeof window > "u", Xe = W |
580
592
  }
581
593
  getInitialEditor() {
582
594
  let e = this.options.current.immediatelyRender, t = e ?? !0;
583
- return W ? (t && U && console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"), t = !1) : Xe && e === void 0 && (t = !1, U && console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")), t ? this.createEditor() : null;
595
+ return W ? (t && U && console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"), t = !1) : $e && e === void 0 && (t = !1, U && console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")), t ? this.createEditor() : null;
584
596
  }
585
597
  createEditor() {
586
598
  let e = {
@@ -699,10 +711,10 @@ var U = process.env.NODE_ENV !== "production", W = typeof window > "u", Xe = W |
699
711
  }, 1);
700
712
  }
701
713
  };
702
- function Qe(e = {}, t = []) {
714
+ function tt(e = {}, t = []) {
703
715
  let n = _(e);
704
716
  n.current = e;
705
- let [r] = v(() => new Ze(n)), i = (0, E.useSyncExternalStore)(r.subscribe, r.getEditor, r.getServerSnapshot);
717
+ let [r] = v(() => new et(n)), i = (0, T.useSyncExternalStore)(r.subscribe, r.getEditor, r.getServerSnapshot);
706
718
  return p(i), m(r.onRender(t)), H({
707
719
  editor: i,
708
720
  selector: ({ transactionNumber: t }) => e.shouldRerenderOnTransaction === !1 || e.shouldRerenderOnTransaction === void 0 ? null : e.immediatelyRender && t === 0 ? 0 : t + 1
@@ -710,12 +722,12 @@ function Qe(e = {}, t = []) {
710
722
  }
711
723
  var G = s({ editor: null });
712
724
  G.Consumer;
713
- var $e = () => f(G), K = s({
725
+ var nt = () => f(G), K = s({
714
726
  onDragStart: () => {},
715
727
  nodeViewContentChildren: void 0,
716
728
  nodeViewContentRef: () => {}
717
- }), et = () => f(K), tt = o.forwardRef((e, t) => {
718
- let { onDragStart: n } = et(), r = e.as || "div";
729
+ }), rt = () => f(K), it = o.forwardRef((e, t) => {
730
+ let { onDragStart: n } = rt(), r = e.as || "div";
719
731
  return /* @__PURE__ */ S(r, {
720
732
  ...e,
721
733
  ref: t,
@@ -731,26 +743,26 @@ function q(e) {
731
743
  return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
732
744
  }
733
745
  function J(e) {
734
- return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.forward_ref)" || e.$$typeof.description === "react.forward_ref"));
746
+ return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.forward_ref)" && e.$$typeof.description !== "react.forward_ref");
735
747
  }
736
- function Y(e) {
737
- return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.memo)" || e.$$typeof.description === "react.memo"));
748
+ function at(e) {
749
+ return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.memo)" && e.$$typeof.description !== "react.memo");
738
750
  }
739
- function nt(e) {
751
+ function ot(e) {
740
752
  if (q(e) || J(e)) return !0;
741
- if (Y(e)) {
753
+ if (at(e)) {
742
754
  let t = e.type;
743
755
  if (t) return q(t) || J(t);
744
756
  }
745
757
  return !1;
746
758
  }
747
- function rt() {
759
+ function st() {
748
760
  try {
749
761
  if (y) return parseInt(y.split(".")[0], 10) >= 19;
750
762
  } catch {}
751
763
  return !1;
752
764
  }
753
- var X = class {
765
+ var Y = class {
754
766
  constructor(e, { editor: t, props: n = {}, as: r = "div", className: i = "" }) {
755
767
  this.ref = null, this.destroyed = !1, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = n, this.element = document.createElement(r), this.element.classList.add("react-renderer"), i && this.element.classList.add(...i.split(" ")), this.editor.isEditorContentInitialized ? ee(() => {
756
768
  this.render();
@@ -761,7 +773,7 @@ var X = class {
761
773
  render() {
762
774
  var e;
763
775
  if (this.destroyed) return;
764
- let t = this.component, n = this.props, r = this.editor, i = rt(), a = nt(t), o = { ...n };
776
+ let t = this.component, n = this.props, r = this.editor, i = st(), a = ot(t), o = { ...n };
765
777
  o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
766
778
  this.ref = e;
767
779
  }), this.reactElement = /* @__PURE__ */ S(t, { ...o }), r == null || (e = r.contentComponent) == null || e.setRenderer(this.id, this);
@@ -797,7 +809,7 @@ var X = class {
797
809
  }
798
810
  };
799
811
  o.createContext({ markViewContentRef: () => {} });
800
- function it(e) {
812
+ function ct(e) {
801
813
  var t;
802
814
  let n = e.getRootNode(), r = typeof n.getSelection == "function" ? n.getSelection() : (t = e.ownerDocument) == null || (t = t.defaultView) == null ? void 0 : t.getSelection();
803
815
  if (!r || r.rangeCount === 0) return null;
@@ -808,9 +820,53 @@ function it(e) {
808
820
  } catch {}
809
821
  };
810
822
  }
811
- var at = class extends r {
823
+ function lt(e, t, n) {
824
+ return e.node(n) === t.node(n) && e.before(n) === t.before(n);
825
+ }
826
+ function X(e) {
827
+ if (!n(e)) return [];
828
+ let { $from: t, $to: r } = e, i = [], a = Math.min(t.depth, r.depth);
829
+ for (let e = 1; e <= a && lt(t, r, e); e += 1) i.push(t.before(e));
830
+ return i;
831
+ }
832
+ var ut = class {
833
+ constructor(e) {
834
+ this.views = /* @__PURE__ */ new WeakMap(), this.viewCount = 0, this.insideViews = /* @__PURE__ */ new Set(), this.syncQueued = !1, this.scheduleSync = () => {
835
+ this.syncQueued || (this.syncQueued = !0, queueMicrotask(() => {
836
+ this.syncQueued = !1, this.sync();
837
+ }));
838
+ }, this.handleTransaction = () => this.scheduleSync(), this.editor = e;
839
+ }
840
+ register(e) {
841
+ this.viewCount === 0 && this.editor.on("transaction", this.handleTransaction), this.views.set(e.dom, e), this.viewCount += 1, this.scheduleSync();
842
+ }
843
+ unregister(e) {
844
+ this.views.delete(e.dom), --this.viewCount, this.insideViews.delete(e), this.viewCount === 0 && this.editor.off("transaction", this.handleTransaction);
845
+ }
846
+ sync() {
847
+ if (this.viewCount === 0 || this.editor.isDestroyed) return;
848
+ let e = this.findInsideViews();
849
+ this.updateViews(this.insideViews, e, !1), this.updateViews(e, this.insideViews, !0), this.insideViews = e;
850
+ }
851
+ updateViews(e, t, n) {
852
+ for (let r of e) t.has(r) || r.setSelectionInside(n);
853
+ }
854
+ findInsideViews() {
855
+ let e = /* @__PURE__ */ new Set();
856
+ for (let t of X(this.editor.state.selection)) {
857
+ let n = this.editor.view.nodeDOM(t), r = n ? this.views.get(n) : void 0;
858
+ r && e.add(r);
859
+ }
860
+ return e;
861
+ }
862
+ }, Z = /* @__PURE__ */ new WeakMap();
863
+ function Q(e) {
864
+ let t = Z.get(e);
865
+ return t || (t = new ut(e), Z.set(e, t)), t;
866
+ }
867
+ var dt = class extends r {
812
868
  constructor(e, t, n) {
813
- if (super(e, t, n), this.selectionRafId = null, this.handlePositionUpdate = () => {
869
+ if (super(e, t, n), this.nodeSelected = !1, this.handlePositionUpdate = () => {
814
870
  let e = this.getPos();
815
871
  typeof e == "number" && e !== this.currentPos && (this.currentPos = e, this.renderer.updateProps({ getPos: () => this.getPos() }), typeof this.options.attrs == "function" && this.updateElementAttributes());
816
872
  }, this.cachedExtensionWithSyncedStorage = null, !this.node.isLeaf) {
@@ -837,6 +893,7 @@ var at = class extends r {
837
893
  innerDecorations: this.innerDecorations,
838
894
  view: this.view,
839
895
  selected: !1,
896
+ selectionInside: !1,
840
897
  extension: this.extensionWithSyncedStorage,
841
898
  HTMLAttributes: this.HTMLAttributes,
842
899
  getPos: () => this.getPos(),
@@ -853,7 +910,7 @@ var at = class extends r {
853
910
  nodeViewContentRef: (e) => {
854
911
  if (e && this.contentDOMElement && e.firstChild !== this.contentDOMElement) {
855
912
  e.hasAttribute("data-node-view-wrapper") && e.removeAttribute("data-node-view-wrapper");
856
- let t = it(this.contentDOMElement);
913
+ let t = ct(this.contentDOMElement);
857
914
  e.appendChild(this.contentDOMElement), t?.();
858
915
  }
859
916
  }
@@ -865,12 +922,12 @@ var at = class extends r {
865
922
  let i = this.node.isInline ? "span" : "div";
866
923
  this.options.as && (i = this.options.as);
867
924
  let { className: a = "" } = this.options;
868
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new X(r, {
925
+ this.renderer = new Y(r, {
869
926
  editor: this.editor,
870
927
  props: e,
871
928
  as: i,
872
929
  className: `node-${this.node.type.name} ${a}`.trim()
873
- }), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes(), this.currentPos = this.getPos();
930
+ }), Q(this.editor).register(this), this.updateElementAttributes(), this.currentPos = this.getPos();
874
931
  }
875
932
  get dom() {
876
933
  if (this.renderer.element.firstElementChild && !this.renderer.element.firstElementChild?.hasAttribute("data-node-view-wrapper")) throw Error("Please use the NodeViewWrapper component for your node view.");
@@ -879,26 +936,6 @@ var at = class extends r {
879
936
  get contentDOM() {
880
937
  return this.node.isLeaf ? null : this.contentDOMElement;
881
938
  }
882
- handleSelectionUpdate() {
883
- this.selectionRafId &&= (cancelAnimationFrame(this.selectionRafId), null), this.selectionRafId = requestAnimationFrame(() => {
884
- this.selectionRafId = null;
885
- let e = this.getPos() ?? this.currentPos;
886
- if (typeof e == "number") {
887
- if (n({
888
- selection: this.editor.state.selection,
889
- pos: e,
890
- nodeSize: this.node.nodeSize,
891
- selectedOnTextSelection: this.options.selectedOnTextSelection
892
- })) {
893
- if (this.renderer.props.selected) return;
894
- this.selectNode();
895
- } else {
896
- if (!this.renderer.props.selected) return;
897
- this.deselectNode();
898
- }
899
- }
900
- });
901
- }
902
939
  update(e, t, n) {
903
940
  let r = (e) => {
904
941
  this.renderer.updateProps(e), typeof this.options.attrs == "function" && this.updateElementAttributes();
@@ -933,13 +970,27 @@ var at = class extends r {
933
970
  return this.options.trackNodeViewPosition && (a.getPos = () => this.getPos()), r(a), !0;
934
971
  }
935
972
  selectNode() {
936
- this.renderer.updateProps({ selected: !0 }), this.renderer.element.classList.add("ProseMirror-selectednode");
973
+ this.nodeSelected = !0, this.updateSelectedState(!0);
937
974
  }
938
975
  deselectNode() {
939
- this.renderer.updateProps({ selected: !1 }), this.renderer.element.classList.remove("ProseMirror-selectednode");
976
+ this.nodeSelected = !1, this.updateSelectedState(this.options.selectedOnTextSelection === !0 && this.isTextSelectionInside());
977
+ }
978
+ setSelectionInside(e) {
979
+ let t = this.nodeSelected || this.options.selectedOnTextSelection === !0 && e;
980
+ this.renderer.updateProps({
981
+ selectionInside: e,
982
+ selected: t
983
+ }), this.renderer.element.classList.toggle("ProseMirror-selectednode", t);
984
+ }
985
+ updateSelectedState(e) {
986
+ this.renderer.updateProps({ selected: e }), this.renderer.element.classList.toggle("ProseMirror-selectednode", e);
987
+ }
988
+ isTextSelectionInside() {
989
+ let e = this.getPos();
990
+ return typeof e == "number" && X(this.editor.state.selection).includes(e);
940
991
  }
941
992
  destroy() {
942
- this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null, this.selectionRafId &&= (cancelAnimationFrame(this.selectionRafId), null);
993
+ this.renderer.destroy(), Q(this.editor).unregister(this), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null;
943
994
  }
944
995
  updateElementAttributes() {
945
996
  if (this.options.attrs) {
@@ -955,8 +1006,8 @@ var at = class extends r {
955
1006
  }
956
1007
  }
957
1008
  };
958
- function ot(e, t) {
959
- return (n) => n.editor.contentComponent ? new at(e, n, t) : {
1009
+ function ft(e, t) {
1010
+ return (n) => n.editor.contentComponent ? new dt(e, n, t) : {
960
1011
  dom: document.createElement("span"),
961
1012
  contentDOM: null,
962
1013
  update: () => !1,
@@ -967,31 +1018,31 @@ function ot(e, t) {
967
1018
  ignoreMutation: () => !0
968
1019
  };
969
1020
  }
970
- var Z = s({ get editor() {
1021
+ var $ = s({ get editor() {
971
1022
  throw Error("useTiptap must be used within a <Tiptap> provider");
972
1023
  } });
973
- Z.displayName = "TiptapContext";
974
- var st = () => f(Z);
975
- function Q({ children: e, ...t }) {
1024
+ $.displayName = "TiptapContext";
1025
+ var pt = () => f($);
1026
+ function mt({ children: e, ...t }) {
976
1027
  let n = "editor" in t ? t.editor : t.instance;
977
1028
  if (!n) throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
978
1029
  let r = g(() => ({ editor: n }), [n]), i = g(() => ({ editor: n }), [n]);
979
1030
  return /* @__PURE__ */ S(G.Provider, {
980
1031
  value: i,
981
- children: /* @__PURE__ */ S(Z.Provider, {
1032
+ children: /* @__PURE__ */ S($.Provider, {
982
1033
  value: r,
983
1034
  children: e
984
1035
  })
985
1036
  });
986
1037
  }
987
- Q.displayName = "Tiptap";
988
- function $({ ...e }) {
989
- let { editor: t } = st();
1038
+ mt.displayName = "Tiptap";
1039
+ function ht({ ...e }) {
1040
+ let { editor: t } = pt();
990
1041
  return /* @__PURE__ */ S(V, {
991
1042
  editor: t,
992
1043
  ...e
993
1044
  });
994
1045
  }
995
- $.displayName = "Tiptap.Content", Object.assign(Q, { Content: $ });
1046
+ ht.displayName = "Tiptap.Content", Object.assign(mt, { Content: ht });
996
1047
  //#endregion
997
- export { $e as a, X as i, tt as n, Qe as o, ot as r, H as s, V as t };
1048
+ export { nt as a, Y as i, it as n, tt as o, ft as r, H as s, V as t };