@clevertask/scribe 0.1.5 → 0.1.7

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.
@@ -1,686 +0,0 @@
1
- import { n as e, t } from "./rolldown-runtime-B8UxIWdF.js";
2
- import n, { createContext as r, forwardRef as i, useContext as a, useDebugValue as o, useEffect as s, useLayoutEffect as c, useMemo as l, useState as u, version as d } from "react";
3
- import f, { flushSync as p } from "react-dom";
4
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
- //#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.production.js
6
- var _ = /* @__PURE__ */ t(((t) => {
7
- var n = e("react");
8
- function r(e, t) {
9
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
10
- }
11
- var i = typeof Object.is == "function" ? Object.is : r, a = n.useState, o = n.useEffect, s = n.useLayoutEffect, c = n.useDebugValue;
12
- function l(e, t) {
13
- var n = t(), r = a({ inst: {
14
- value: n,
15
- getSnapshot: t
16
- } }), i = r[0].inst, l = r[1];
17
- return s(function() {
18
- i.value = n, i.getSnapshot = t, u(i) && l({ inst: i });
19
- }, [
20
- e,
21
- n,
22
- t
23
- ]), o(function() {
24
- return u(i) && l({ inst: i }), e(function() {
25
- u(i) && l({ inst: i });
26
- });
27
- }, [e]), c(n), n;
28
- }
29
- function u(e) {
30
- var t = e.getSnapshot;
31
- e = e.value;
32
- try {
33
- var n = t();
34
- return !i(e, n);
35
- } catch {
36
- return !0;
37
- }
38
- }
39
- function d(e, t) {
40
- return t();
41
- }
42
- var f = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? d : l;
43
- t.useSyncExternalStore = n.useSyncExternalStore === void 0 ? f : n.useSyncExternalStore;
44
- })), v = /* @__PURE__ */ t(((t) => {
45
- process.env.NODE_ENV !== "production" && (function() {
46
- function n(e, t) {
47
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
48
- }
49
- function r(e, t) {
50
- f || o.startTransition === void 0 || (f = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
51
- var n = t();
52
- if (!p) {
53
- var r = t();
54
- s(n, r) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), p = !0);
55
- }
56
- r = c({ inst: {
57
- value: n,
58
- getSnapshot: t
59
- } });
60
- var a = r[0].inst, m = r[1];
61
- return u(function() {
62
- a.value = n, a.getSnapshot = t, i(a) && m({ inst: a });
63
- }, [
64
- e,
65
- n,
66
- t
67
- ]), l(function() {
68
- return i(a) && m({ inst: a }), e(function() {
69
- i(a) && m({ inst: a });
70
- });
71
- }, [e]), d(n), n;
72
- }
73
- function i(e) {
74
- var t = e.getSnapshot;
75
- e = e.value;
76
- try {
77
- var n = t();
78
- return !s(e, n);
79
- } catch {
80
- return !0;
81
- }
82
- }
83
- function a(e, t) {
84
- return t();
85
- }
86
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
87
- var o = e("react"), s = typeof Object.is == "function" ? Object.is : n, c = o.useState, l = o.useEffect, u = o.useLayoutEffect, d = o.useDebugValue, f = !1, p = !1, m = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? a : r;
88
- t.useSyncExternalStore = o.useSyncExternalStore === void 0 ? m : o.useSyncExternalStore, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
89
- })();
90
- })), y = /* @__PURE__ */ t(((e, t) => {
91
- process.env.NODE_ENV === "production" ? t.exports = _() : t.exports = v();
92
- })), b = y(), { getOwnPropertyNames: x, getOwnPropertySymbols: S } = Object, { hasOwnProperty: ee } = Object.prototype;
93
- function C(e, t) {
94
- return function(n, r, i) {
95
- return e(n, r, i) && t(n, r, i);
96
- };
97
- }
98
- function w(e) {
99
- return function(t, n, r) {
100
- if (!t || !n || typeof t != "object" || typeof n != "object") return e(t, n, r);
101
- let { cache: i } = r, a = i.get(t), o = i.get(n);
102
- if (a && o) return a === n && o === t;
103
- i.set(t, n), i.set(n, t);
104
- let s = e(t, n, r);
105
- return i.delete(t), i.delete(n), s;
106
- };
107
- }
108
- function te(e) {
109
- return e?.[Symbol.toStringTag];
110
- }
111
- function T(e) {
112
- return x(e).concat(S(e));
113
- }
114
- var ne = Object.hasOwn || ((e, t) => ee.call(e, t));
115
- function E(e, t) {
116
- return e === t || !e && !t && e !== e && t !== t;
117
- }
118
- var re = "__v", ie = "__o", ae = "_owner", { getOwnPropertyDescriptor: D, keys: O } = Object;
119
- function k(e, t) {
120
- return e.byteLength === t.byteLength && R(new Uint8Array(e), new Uint8Array(t));
121
- }
122
- function A(e, t, n) {
123
- let r = e.length;
124
- if (t.length !== r) return !1;
125
- for (; r-- > 0;) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1;
126
- return !0;
127
- }
128
- function oe(e, t) {
129
- return e.byteLength === t.byteLength && R(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
130
- }
131
- function se(e, t) {
132
- return E(e.getTime(), t.getTime());
133
- }
134
- function ce(e, t) {
135
- return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
136
- }
137
- function le(e, t) {
138
- return e === t;
139
- }
140
- function j(e, t, n) {
141
- let r = e.size;
142
- if (r !== t.size) return !1;
143
- if (!r) return !0;
144
- let i = Array(r), a = e.entries(), o, s, c = 0;
145
- for (; (o = a.next()) && !o.done;) {
146
- let r = t.entries(), a = !1, l = 0;
147
- for (; (s = r.next()) && !s.done;) {
148
- if (i[l]) {
149
- l++;
150
- continue;
151
- }
152
- let r = o.value, u = s.value;
153
- if (n.equals(r[0], u[0], c, l, e, t, n) && n.equals(r[1], u[1], r[0], u[0], e, t, n)) {
154
- a = i[l] = !0;
155
- break;
156
- }
157
- l++;
158
- }
159
- if (!a) return !1;
160
- c++;
161
- }
162
- return !0;
163
- }
164
- var M = E;
165
- function N(e, t, n) {
166
- let r = O(e), i = r.length;
167
- if (O(t).length !== i) return !1;
168
- for (; i-- > 0;) if (!B(e, t, n, r[i])) return !1;
169
- return !0;
170
- }
171
- function P(e, t, n) {
172
- let r = T(e), i = r.length;
173
- if (T(t).length !== i) return !1;
174
- let a, o, s;
175
- for (; i-- > 0;) if (a = r[i], !B(e, t, n, a) || (o = D(e, a), s = D(t, a), (o || s) && (!o || !s || o.configurable !== s.configurable || o.enumerable !== s.enumerable || o.writable !== s.writable))) return !1;
176
- return !0;
177
- }
178
- function F(e, t) {
179
- return E(e.valueOf(), t.valueOf());
180
- }
181
- function I(e, t) {
182
- return e.source === t.source && e.flags === t.flags;
183
- }
184
- function L(e, t, n) {
185
- let r = e.size;
186
- if (r !== t.size) return !1;
187
- if (!r) return !0;
188
- let i = Array(r), a = e.values(), o, s;
189
- for (; (o = a.next()) && !o.done;) {
190
- let r = t.values(), a = !1, c = 0;
191
- for (; (s = r.next()) && !s.done;) {
192
- if (!i[c] && n.equals(o.value, s.value, o.value, s.value, e, t, n)) {
193
- a = i[c] = !0;
194
- break;
195
- }
196
- c++;
197
- }
198
- if (!a) return !1;
199
- }
200
- return !0;
201
- }
202
- function R(e, t) {
203
- let n = e.byteLength;
204
- if (t.byteLength !== n || e.byteOffset !== t.byteOffset) return !1;
205
- for (; n-- > 0;) if (e[n] !== t[n]) return !1;
206
- return !0;
207
- }
208
- function z(e, t) {
209
- 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;
210
- }
211
- function B(e, t, n, r) {
212
- return (r === ae || r === ie || r === re) && (e.$$typeof || t.$$typeof) ? !0 : ne(t, r) && n.equals(e[r], t[r], r, r, e, t, n);
213
- }
214
- var V = "[object ArrayBuffer]", H = "[object Arguments]", U = "[object Boolean]", W = "[object DataView]", ue = "[object Date]", de = "[object Error]", fe = "[object Map]", pe = "[object Number]", me = "[object Object]", he = "[object RegExp]", ge = "[object Set]", _e = "[object String]", ve = {
215
- "[object Int8Array]": !0,
216
- "[object Uint8Array]": !0,
217
- "[object Uint8ClampedArray]": !0,
218
- "[object Int16Array]": !0,
219
- "[object Uint16Array]": !0,
220
- "[object Int32Array]": !0,
221
- "[object Uint32Array]": !0,
222
- "[object Float16Array]": !0,
223
- "[object Float32Array]": !0,
224
- "[object Float64Array]": !0,
225
- "[object BigInt64Array]": !0,
226
- "[object BigUint64Array]": !0
227
- }, ye = "[object URL]", be = Object.prototype.toString;
228
- function G({ 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 }) {
229
- return function(h, g, _) {
230
- if (h === g) return !0;
231
- if (h == null || g == null) return !1;
232
- let v = typeof h;
233
- if (v !== typeof g) return !1;
234
- if (v !== "object") return v === "number" ? s(h, g, _) : v === "function" && a(h, g, _);
235
- let y = h.constructor;
236
- if (y !== g.constructor) return !1;
237
- if (y === Object) return c(h, g, _);
238
- if (Array.isArray(h)) return t(h, g, _);
239
- if (y === Date) return r(h, g, _);
240
- if (y === RegExp) return u(h, g, _);
241
- if (y === Map) return o(h, g, _);
242
- if (y === Set) return d(h, g, _);
243
- let b = be.call(h);
244
- if (b === ue) return r(h, g, _);
245
- if (b === he) return u(h, g, _);
246
- if (b === fe) return o(h, g, _);
247
- if (b === ge) return d(h, g, _);
248
- if (b === me) return typeof h.then != "function" && typeof g.then != "function" && c(h, g, _);
249
- if (b === ye) return p(h, g, _);
250
- if (b === de) return i(h, g, _);
251
- if (b === H) return c(h, g, _);
252
- if (ve[b]) return f(h, g, _);
253
- if (b === V) return e(h, g, _);
254
- if (b === W) return n(h, g, _);
255
- if (b === U || b === pe || b === _e) return l(h, g, _);
256
- if (m) {
257
- let e = m[b];
258
- if (!e) {
259
- let t = te(h);
260
- t && (e = m[t]);
261
- }
262
- if (e) return e(h, g, _);
263
- }
264
- return !1;
265
- };
266
- }
267
- function xe({ circular: e, createCustomConfig: t, strict: n }) {
268
- let r = {
269
- areArrayBuffersEqual: k,
270
- areArraysEqual: n ? P : A,
271
- areDataViewsEqual: oe,
272
- areDatesEqual: se,
273
- areErrorsEqual: ce,
274
- areFunctionsEqual: le,
275
- areMapsEqual: n ? C(j, P) : j,
276
- areNumbersEqual: M,
277
- areObjectsEqual: n ? P : N,
278
- arePrimitiveWrappersEqual: F,
279
- areRegExpsEqual: I,
280
- areSetsEqual: n ? C(L, P) : L,
281
- areTypedArraysEqual: n ? C(R, P) : R,
282
- areUrlsEqual: z,
283
- unknownTagComparators: void 0
284
- };
285
- if (t && (r = Object.assign({}, r, t(r))), e) {
286
- let e = w(r.areArraysEqual), t = w(r.areMapsEqual), n = w(r.areObjectsEqual), i = w(r.areSetsEqual);
287
- r = Object.assign({}, r, {
288
- areArraysEqual: e,
289
- areMapsEqual: t,
290
- areObjectsEqual: n,
291
- areSetsEqual: i
292
- });
293
- }
294
- return r;
295
- }
296
- function Se(e) {
297
- return function(t, n, r, i, a, o, s) {
298
- return e(t, n, s);
299
- };
300
- }
301
- function Ce({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
302
- if (n) return function(a, o) {
303
- let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
304
- return t(a, o, {
305
- cache: s,
306
- equals: r,
307
- meta: c,
308
- strict: i
309
- });
310
- };
311
- if (e) return function(e, n) {
312
- return t(e, n, {
313
- cache: /* @__PURE__ */ new WeakMap(),
314
- equals: r,
315
- meta: void 0,
316
- strict: i
317
- });
318
- };
319
- let a = {
320
- cache: void 0,
321
- equals: r,
322
- meta: void 0,
323
- strict: i
324
- };
325
- return function(e, n) {
326
- return t(e, n, a);
327
- };
328
- }
329
- var we = K();
330
- K({ strict: !0 }), K({ circular: !0 }), K({
331
- circular: !0,
332
- strict: !0
333
- }), K({ createInternalComparator: () => E }), K({
334
- strict: !0,
335
- createInternalComparator: () => E
336
- }), K({
337
- circular: !0,
338
- createInternalComparator: () => E
339
- }), K({
340
- circular: !0,
341
- createInternalComparator: () => E,
342
- strict: !0
343
- });
344
- function K(e = {}) {
345
- let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = G(xe(e));
346
- return Ce({
347
- circular: t,
348
- comparator: a,
349
- createState: r,
350
- equals: n ? n(a) : Se(a),
351
- strict: i
352
- });
353
- }
354
- //#endregion
355
- //#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
356
- var Te = /* @__PURE__ */ t(((t) => {
357
- var n = e("react"), r = y();
358
- function i(e, t) {
359
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
360
- }
361
- var a = typeof Object.is == "function" ? Object.is : i, o = r.useSyncExternalStore, s = n.useRef, c = n.useEffect, l = n.useMemo, u = n.useDebugValue;
362
- t.useSyncExternalStoreWithSelector = function(e, t, n, r, i) {
363
- var d = s(null);
364
- if (d.current === null) {
365
- var f = {
366
- hasValue: !1,
367
- value: null
368
- };
369
- d.current = f;
370
- } else f = d.current;
371
- d = l(function() {
372
- function e(e) {
373
- if (!o) {
374
- if (o = !0, s = e, e = r(e), i !== void 0 && f.hasValue) {
375
- var t = f.value;
376
- if (i(t, e)) return c = t;
377
- }
378
- return c = e;
379
- }
380
- if (t = c, a(s, e)) return t;
381
- var n = r(e);
382
- return i !== void 0 && i(t, n) ? (s = e, t) : (s = e, c = n);
383
- }
384
- var o = !1, s, c, l = n === void 0 ? null : n;
385
- return [function() {
386
- return e(t());
387
- }, l === null ? void 0 : function() {
388
- return e(l());
389
- }];
390
- }, [
391
- t,
392
- n,
393
- r,
394
- i
395
- ]);
396
- var p = o(e, d[0], d[1]);
397
- return c(function() {
398
- f.hasValue = !0, f.value = p;
399
- }, [p]), u(p), p;
400
- };
401
- })), Ee = /* @__PURE__ */ t(((t) => {
402
- process.env.NODE_ENV !== "production" && (function() {
403
- function n(e, t) {
404
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
405
- }
406
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
407
- var r = e("react"), i = y(), a = typeof Object.is == "function" ? Object.is : n, o = i.useSyncExternalStore, s = r.useRef, c = r.useEffect, l = r.useMemo, u = r.useDebugValue;
408
- t.useSyncExternalStoreWithSelector = function(e, t, n, r, i) {
409
- var d = s(null);
410
- if (d.current === null) {
411
- var f = {
412
- hasValue: !1,
413
- value: null
414
- };
415
- d.current = f;
416
- } else f = d.current;
417
- d = l(function() {
418
- function e(e) {
419
- if (!o) {
420
- if (o = !0, s = e, e = r(e), i !== void 0 && f.hasValue) {
421
- var t = f.value;
422
- if (i(t, e)) return c = t;
423
- }
424
- return c = e;
425
- }
426
- if (t = c, a(s, e)) return t;
427
- var n = r(e);
428
- return i !== void 0 && i(t, n) ? (s = e, t) : (s = e, c = n);
429
- }
430
- var o = !1, s, c, l = n === void 0 ? null : n;
431
- return [function() {
432
- return e(t());
433
- }, l === null ? void 0 : function() {
434
- return e(l());
435
- }];
436
- }, [
437
- t,
438
- n,
439
- r,
440
- i
441
- ]);
442
- var p = o(e, d[0], d[1]);
443
- return c(function() {
444
- f.hasValue = !0, f.value = p;
445
- }, [p]), u(p), p;
446
- }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
447
- })();
448
- })), De = (/* @__PURE__ */ t(((e, t) => {
449
- process.env.NODE_ENV === "production" ? t.exports = Te() : t.exports = Ee();
450
- })))(), Oe = (...e) => (t) => {
451
- e.forEach((e) => {
452
- typeof e == "function" ? e(t) : e && (e.current = t);
453
- });
454
- }, ke = ({ contentComponent: e }) => {
455
- let t = (0, b.useSyncExternalStore)(e.subscribe, e.getSnapshot, e.getServerSnapshot);
456
- return /* @__PURE__ */ h(m, { children: Object.values(t) });
457
- };
458
- function Ae() {
459
- let e = /* @__PURE__ */ new Set(), t = {}, n = !1, r = () => {
460
- n || !e.size || (n = !0, queueMicrotask(() => {
461
- n = !1, e.forEach((e) => e());
462
- }));
463
- };
464
- return {
465
- subscribe(t) {
466
- return e.add(t), () => {
467
- e.delete(t);
468
- };
469
- },
470
- getSnapshot() {
471
- return t;
472
- },
473
- getServerSnapshot() {
474
- return t;
475
- },
476
- setRenderer(e, n) {
477
- t = {
478
- ...t,
479
- [e]: f.createPortal(n.reactElement, n.element, e)
480
- }, r();
481
- },
482
- removeRenderer(e) {
483
- let n = { ...t };
484
- delete n[e], t = n, r();
485
- }
486
- };
487
- }
488
- var je = class extends n.Component {
489
- constructor(e) {
490
- super(e), this.editorContentRef = n.createRef();
491
- }
492
- componentDidMount() {
493
- this.init();
494
- }
495
- componentDidUpdate() {
496
- this.init();
497
- }
498
- init() {
499
- let e = this.props.editor;
500
- if (e && !e.isDestroyed && e.view.dom?.parentNode) {
501
- if (e.contentComponent) return;
502
- let t = this.editorContentRef.current;
503
- t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent = Ae(), e.createNodeViews(), e.isEditorContentInitialized = !0, this.forceUpdate();
504
- }
505
- }
506
- componentWillUnmount() {
507
- let e = this.props.editor;
508
- if (e) {
509
- e.isEditorContentInitialized = !1, e.isDestroyed || e.view.setProps({ nodeViews: {} }), e.contentComponent = null;
510
- try {
511
- if (!e.view.dom?.parentNode) return;
512
- let t = document.createElement("div");
513
- t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t });
514
- } catch {}
515
- }
516
- }
517
- render() {
518
- let { editor: e, innerRef: t, ...n } = this.props;
519
- return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
520
- ref: Oe(t, this.editorContentRef),
521
- ...n
522
- }), e?.contentComponent && /* @__PURE__ */ h(ke, { contentComponent: e.contentComponent })] });
523
- }
524
- }, Me = i((e, t) => {
525
- let r = n.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
526
- return n.createElement(je, {
527
- key: r,
528
- innerRef: t,
529
- ...e
530
- });
531
- }), q = n.memo(Me), Ne = typeof window < "u" ? c : s, Pe = class {
532
- constructor(e) {
533
- this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = {
534
- editor: e,
535
- transactionNumber: 0
536
- }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
537
- }
538
- getSnapshot() {
539
- return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = {
540
- editor: this.editor,
541
- transactionNumber: this.transactionNumber
542
- }, this.lastSnapshot);
543
- }
544
- getServerSnapshot() {
545
- return {
546
- editor: null,
547
- transactionNumber: 0
548
- };
549
- }
550
- subscribe(e) {
551
- return this.subscribers.add(e), () => {
552
- this.subscribers.delete(e);
553
- };
554
- }
555
- watch(e) {
556
- if (this.editor = e, this.editor) {
557
- let e, t = (t) => {
558
- t?.transaction !== void 0 && t.transaction === e || (e = t?.transaction, this.transactionNumber += 1, this.subscribers.forEach((e) => e()));
559
- }, n = this.editor;
560
- return n.on("transaction", t), n.on("update", t), () => {
561
- n.off("transaction", t), n.off("update", t);
562
- };
563
- }
564
- }
565
- };
566
- function Fe(e) {
567
- let [t] = u(() => new Pe(e.editor)), n = (0, De.useSyncExternalStoreWithSelector)(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn ?? we);
568
- return Ne(() => t.watch(e.editor), [e.editor, t]), o(n), n;
569
- }
570
- process.env.NODE_ENV, typeof window > "u" || typeof window < "u" && window.next;
571
- var J = r({ editor: null });
572
- J.Consumer;
573
- var Ie = () => a(J), Le = r({
574
- onDragStart: () => {},
575
- nodeViewContentChildren: void 0,
576
- nodeViewContentRef: () => {}
577
- }), Re = () => a(Le);
578
- n.forwardRef((e, t) => {
579
- let { onDragStart: n } = Re();
580
- return /* @__PURE__ */ h(e.as || "div", {
581
- ...e,
582
- ref: t,
583
- "data-node-view-wrapper": "",
584
- onDragStart: n,
585
- style: {
586
- whiteSpace: "normal",
587
- ...e.style
588
- }
589
- });
590
- });
591
- function Y(e) {
592
- return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
593
- }
594
- function X(e) {
595
- return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.forward_ref)" || e.$$typeof.description === "react.forward_ref"));
596
- }
597
- function ze(e) {
598
- return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.memo)" || e.$$typeof.description === "react.memo"));
599
- }
600
- function Be(e) {
601
- if (Y(e) || X(e)) return !0;
602
- if (ze(e)) {
603
- let t = e.type;
604
- if (t) return Y(t) || X(t);
605
- }
606
- return !1;
607
- }
608
- function Ve() {
609
- try {
610
- if (d) return parseInt(d.split(".")[0], 10) >= 19;
611
- } catch {}
612
- return !1;
613
- }
614
- var He = class {
615
- constructor(e, { editor: t, props: n = {}, as: r = "div", className: i = "" }) {
616
- 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 ? p(() => {
617
- this.render();
618
- }) : queueMicrotask(() => {
619
- this.destroyed || this.render();
620
- });
621
- }
622
- render() {
623
- var e;
624
- if (this.destroyed) return;
625
- let t = this.component, n = this.props, r = this.editor, i = Ve(), a = Be(t), o = { ...n };
626
- o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
627
- this.ref = e;
628
- }), this.reactElement = /* @__PURE__ */ h(t, { ...o }), (e = r?.contentComponent) == null || e.setRenderer(this.id, this);
629
- }
630
- updateProps(e = {}) {
631
- if (this.destroyed) return;
632
- let t = !1, n = Object.keys(e);
633
- for (let r = 0; r < n.length; r += 1) {
634
- let i = n[r];
635
- if (e[i] !== this.props[i]) {
636
- t = !0;
637
- break;
638
- }
639
- }
640
- t && (this.props = {
641
- ...this.props,
642
- ...e
643
- }, this.render());
644
- }
645
- destroy() {
646
- var e;
647
- this.destroyed = !0, (e = this.editor?.contentComponent) == null || e.removeRenderer(this.id);
648
- try {
649
- this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
650
- } catch {}
651
- }
652
- updateAttributes(e) {
653
- Object.keys(e).forEach((t) => {
654
- this.element.setAttribute(t, e[t]);
655
- });
656
- }
657
- };
658
- n.createContext({ markViewContentRef: () => {} });
659
- var Z = r({ get editor() {
660
- throw Error("useTiptap must be used within a <Tiptap> provider");
661
- } });
662
- Z.displayName = "TiptapContext";
663
- var Ue = () => a(Z);
664
- function Q({ children: e, ...t }) {
665
- let n = "editor" in t ? t.editor : t.instance;
666
- if (!n) throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
667
- let r = l(() => ({ editor: n }), [n]), i = l(() => ({ editor: n }), [n]);
668
- return /* @__PURE__ */ h(J.Provider, {
669
- value: i,
670
- children: /* @__PURE__ */ h(Z.Provider, {
671
- value: r,
672
- children: e
673
- })
674
- });
675
- }
676
- Q.displayName = "Tiptap";
677
- function $({ ...e }) {
678
- let { editor: t } = Ue();
679
- return /* @__PURE__ */ h(q, {
680
- editor: t,
681
- ...e
682
- });
683
- }
684
- $.displayName = "Tiptap.Content", Object.assign(Q, { Content: $ });
685
- //#endregion
686
- export { Fe as i, He as n, Ie as r, q as t };
@@ -1,7 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
3
- if (typeof require < "u") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
- });
6
- //#endregion
7
- export { t as n, e as t };