@caspeco/casper-ui-library 9.9.0 → 9.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/_virtual/index.js +5 -0
  2. package/dist/_virtual/index2.js +4 -0
  3. package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
  4. package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
  5. package/dist/_virtual/with-selector.development.js +4 -0
  6. package/dist/_virtual/with-selector.js +5 -0
  7. package/dist/_virtual/with-selector.production.js +4 -0
  8. package/dist/_virtual/with-selector2.js +4 -0
  9. package/dist/components/button/button-recipe.d.ts.map +1 -1
  10. package/dist/components/button/button-recipe.js +80 -39
  11. package/dist/components/input/input.d.ts +1 -0
  12. package/dist/components/input/input.d.ts.map +1 -1
  13. package/dist/components/input/types.d.ts +1 -1
  14. package/dist/components/input/types.d.ts.map +1 -1
  15. package/dist/components/rich-text-editor/boolean-control.d.ts +3 -0
  16. package/dist/components/rich-text-editor/boolean-control.d.ts.map +1 -0
  17. package/dist/components/rich-text-editor/boolean-control.js +35 -0
  18. package/dist/components/rich-text-editor/extensions.d.ts +4 -0
  19. package/dist/components/rich-text-editor/extensions.d.ts.map +1 -0
  20. package/dist/components/rich-text-editor/extensions.js +37 -0
  21. package/dist/components/rich-text-editor/index.d.ts +26 -0
  22. package/dist/components/rich-text-editor/index.d.ts.map +1 -0
  23. package/dist/components/rich-text-editor/index.js +23 -0
  24. package/dist/components/rich-text-editor/rich-text-editor-context.d.ts +10 -0
  25. package/dist/components/rich-text-editor/rich-text-editor-context.d.ts.map +1 -0
  26. package/dist/components/rich-text-editor/rich-text-editor-context.js +13 -0
  27. package/dist/components/rich-text-editor/rich-text-editor-control.d.ts +11 -0
  28. package/dist/components/rich-text-editor/rich-text-editor-control.d.ts.map +1 -0
  29. package/dist/components/rich-text-editor/rich-text-editor-control.js +202 -0
  30. package/dist/components/rich-text-editor/rich-text-editor-recipe.d.ts +4 -0
  31. package/dist/components/rich-text-editor/rich-text-editor-recipe.d.ts.map +1 -0
  32. package/dist/components/rich-text-editor/rich-text-editor-recipe.js +58 -0
  33. package/dist/components/rich-text-editor/rich-text-editor.composition.d.ts +6 -0
  34. package/dist/components/rich-text-editor/rich-text-editor.composition.d.ts.map +1 -0
  35. package/dist/components/rich-text-editor/rich-text-editor.d.ts +11 -0
  36. package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -0
  37. package/dist/components/rich-text-editor/rich-text-editor.js +60 -0
  38. package/dist/components/rich-text-editor/rich-text-editor.test.d.ts +2 -0
  39. package/dist/components/rich-text-editor/rich-text-editor.test.d.ts.map +1 -0
  40. package/dist/components/rich-text-editor/rich-text-editor.visual.test.d.ts +2 -0
  41. package/dist/components/rich-text-editor/rich-text-editor.visual.test.d.ts.map +1 -0
  42. package/dist/components/rich-text-editor/rich-text-renderer.d.ts +3 -0
  43. package/dist/components/rich-text-editor/rich-text-renderer.d.ts.map +1 -0
  44. package/dist/components/rich-text-editor/rich-text-renderer.js +21 -0
  45. package/dist/components/rich-text-editor/translations.d.ts +23 -0
  46. package/dist/components/rich-text-editor/translations.d.ts.map +1 -0
  47. package/dist/components/rich-text-editor/translations.js +120 -0
  48. package/dist/components/rich-text-editor/types.d.ts +30 -0
  49. package/dist/components/rich-text-editor/types.d.ts.map +1 -0
  50. package/dist/components/rich-text-editor/use-rich-text-editor.d.ts +3 -0
  51. package/dist/components/rich-text-editor/use-rich-text-editor.d.ts.map +1 -0
  52. package/dist/components/rich-text-editor/use-rich-text-editor.js +17 -0
  53. package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
  54. package/dist/components/toggle-button/toggle-button.js +11 -11
  55. package/dist/components/toggle-button/types.d.ts +2 -0
  56. package/dist/components/toggle-button/types.d.ts.map +1 -1
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +774 -763
  60. package/dist/node_modules/@tiptap/core/dist/index.js +3792 -0
  61. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
  62. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +62 -0
  63. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +85 -0
  64. package/dist/node_modules/@tiptap/extension-code/dist/index.js +54 -0
  65. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +217 -0
  66. package/dist/node_modules/@tiptap/extension-document/dist/index.js +12 -0
  67. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +59 -0
  68. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +63 -0
  69. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +56 -0
  70. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +83 -0
  71. package/dist/node_modules/@tiptap/extension-link/dist/index.js +313 -0
  72. package/dist/node_modules/@tiptap/extension-list/dist/index.js +785 -0
  73. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +49 -0
  74. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +66 -0
  75. package/dist/node_modules/@tiptap/extension-text/dist/index.js +13 -0
  76. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +65 -0
  77. package/dist/node_modules/@tiptap/extensions/dist/index.js +439 -0
  78. package/dist/node_modules/@tiptap/react/dist/index.js +501 -0
  79. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +28 -0
  80. package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
  81. package/dist/node_modules/linkifyjs/dist/linkify.js +705 -0
  82. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  83. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  84. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  85. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  86. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  87. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  88. package/dist/node_modules/prosemirror-model/dist/index.js +2736 -0
  89. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  90. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  91. package/dist/node_modules/prosemirror-transform/dist/index.js +1552 -0
  92. package/dist/node_modules/prosemirror-view/dist/index.js +3802 -0
  93. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  94. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +58 -0
  95. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +57 -0
  96. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +58 -0
  97. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +46 -0
  98. package/dist/node_modules/use-sync-external-store/shim/index.js +10 -0
  99. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +10 -0
  100. package/dist/node_modules/w3c-keyname/index.js +93 -0
  101. package/package.json +7 -1
@@ -0,0 +1,501 @@
1
+ import o, { useState as p, useDebugValue as m, useRef as R, useEffect as f, useLayoutEffect as C, forwardRef as N, createContext as d, useContext as v, useMemo as l } from "react";
2
+ import T from "react-dom";
3
+ import { s as b } from "../../../../_virtual/index.js";
4
+ import { jsxs as D, Fragment as g, jsx as a } from "react/jsx-runtime";
5
+ import { Editor as M } from "../../core/dist/index.js";
6
+ import { CommandManager as re, Extendable as ne, Extension as ie, InputRule as se, MappablePosition as oe, Mark as ae, Node as de, NodePos as ue, PasteRule as ce, callOrReturn as le, canInsertNode as he, combineTransactionSteps as pe, commands as me, createAtomBlockMarkdownSpec as fe, createBlockMarkdownSpec as ve, createChainableState as be, createDocument as ge, createInlineMarkdownSpec as Se, createMappablePosition as Ee, createNodeFromContent as ye, createStyleTag as we, defaultBlockAt as xe, deleteProps as Re, elementFromString as Ce, extensions as Ne, findChildrenInRange as Te, findDuplicates as De, findParentNode as Me, findParentNodeClosestToPos as _e, flattenExtensions as Ie, fromString as Pe, generateHTML as Ae, generateJSON as Oe, getAttributes as ke, getAttributesFromExtensions as Be, getChangedRanges as Fe, getExtensionField as Ve, getHTMLFromFragment as je, getMarkAttributes as Ue, getMarkRange as qe, getMarkType as Le, getMarksBetween as ze, getNodeAtPosition as We, getNodeAttributes as He, getNodeType as Je, getRenderedAttributes as Ke, getSchema as Ge, getSchemaByResolvedExtensions as Qe, getSchemaTypeByName as Xe, getSchemaTypeNameByName as Ye, getSplittedAttributes as Ze, getText as $e, getTextBetween as et, getTextContentFromNodes as tt, getTextSerializersFromSchema as rt, getUpdatedPosition as nt, injectExtensionAttributesToParseRule as it, inputRulesPlugin as st, isActive as ot, isAndroid as at, isAtEndOfNode as dt, isAtStartOfNode as ut, isEmptyObject as ct, isExtensionRulesEnabled as lt, isFunction as ht, isList as pt, isMacOS as mt, isMarkActive as ft, isNodeActive as vt, isNodeEmpty as bt, isNodeSelection as gt, isNumber as St, isPlainObject as Et, isRegExp as yt, isSafari as wt, isTextSelection as xt, isiOS as Rt, markInputRule as Ct, markPasteRule as Nt, markdown as Tt, mergeAttributes as Dt, mergeDeep as Mt, minMax as _t, nodeInputRule as It, objectIncludes as Pt, parseAttributes as At, parseIndentedBlocks as Ot, pasteRulesPlugin as kt, removeDuplicates as Bt, renderNestedMarkdownContent as Ft, resolveExtensions as Vt, resolveFocusPosition as jt, selectionToInsertionEnd as Ut, serializeAttributes as qt, sortExtensions as Lt, splitExtensions as zt, textblockTypeInputRule as Wt, updateMarkViewAttributes as Ht, wrappingInputRule as Jt } from "../../core/dist/index.js";
7
+ import { deepEqual as _ } from "../../../fast-equals/dist/es/index.js";
8
+ import { w as I } from "../../../../_virtual/with-selector.js";
9
+ var P = (...r) => (e) => {
10
+ r.forEach((t) => {
11
+ typeof t == "function" ? t(e) : t && (t.current = e);
12
+ });
13
+ }, A = ({ contentComponent: r }) => {
14
+ const e = b.useSyncExternalStore(
15
+ r.subscribe,
16
+ r.getSnapshot,
17
+ r.getServerSnapshot
18
+ );
19
+ return /* @__PURE__ */ a(g, { children: Object.values(e) });
20
+ };
21
+ function O() {
22
+ const r = /* @__PURE__ */ new Set();
23
+ let e = {};
24
+ return {
25
+ /**
26
+ * Subscribe to the editor instance's changes.
27
+ */
28
+ subscribe(t) {
29
+ return r.add(t), () => {
30
+ r.delete(t);
31
+ };
32
+ },
33
+ getSnapshot() {
34
+ return e;
35
+ },
36
+ getServerSnapshot() {
37
+ return e;
38
+ },
39
+ /**
40
+ * Adds a new NodeView Renderer to the editor.
41
+ */
42
+ setRenderer(t, n) {
43
+ e = {
44
+ ...e,
45
+ [t]: T.createPortal(n.reactElement, n.element, t)
46
+ }, r.forEach((i) => i());
47
+ },
48
+ /**
49
+ * Removes a NodeView Renderer from the editor.
50
+ */
51
+ removeRenderer(t) {
52
+ const n = { ...e };
53
+ delete n[t], e = n, r.forEach((i) => i());
54
+ }
55
+ };
56
+ }
57
+ var k = class extends o.Component {
58
+ constructor(r) {
59
+ super(r), this.editorContentRef = o.createRef();
60
+ }
61
+ componentDidMount() {
62
+ this.init();
63
+ }
64
+ componentDidUpdate() {
65
+ this.init();
66
+ }
67
+ init() {
68
+ var r;
69
+ const e = this.props.editor;
70
+ if (e && !e.isDestroyed && ((r = e.view.dom) != null && r.parentNode)) {
71
+ if (e.contentComponent)
72
+ return;
73
+ const t = this.editorContentRef.current;
74
+ t.append(...e.view.dom.parentNode.childNodes), e.setOptions({
75
+ element: t
76
+ }), e.contentComponent = O(), e.createNodeViews(), e.isEditorContentInitialized = !0, this.forceUpdate();
77
+ }
78
+ }
79
+ componentWillUnmount() {
80
+ var r;
81
+ const e = this.props.editor;
82
+ if (e) {
83
+ e.isEditorContentInitialized = !1, e.isDestroyed || e.view.setProps({
84
+ nodeViews: {}
85
+ }), e.contentComponent = null;
86
+ try {
87
+ if (!((r = e.view.dom) != null && r.parentNode))
88
+ return;
89
+ const t = document.createElement("div");
90
+ t.append(...e.view.dom.parentNode.childNodes), e.setOptions({
91
+ element: t
92
+ });
93
+ } catch {
94
+ }
95
+ }
96
+ }
97
+ render() {
98
+ const { editor: r, innerRef: e, ...t } = this.props;
99
+ return /* @__PURE__ */ D(g, { children: [
100
+ /* @__PURE__ */ a("div", { ref: P(e, this.editorContentRef), ...t }),
101
+ r?.contentComponent && /* @__PURE__ */ a(A, { contentComponent: r.contentComponent })
102
+ ] });
103
+ }
104
+ }, B = N(
105
+ (r, e) => {
106
+ const t = o.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [r.editor]);
107
+ return o.createElement(k, {
108
+ key: t,
109
+ innerRef: e,
110
+ ...r
111
+ });
112
+ }
113
+ ), F = o.memo(B), V = typeof window < "u" ? C : f, j = class {
114
+ constructor(r) {
115
+ this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = r, this.lastSnapshot = { editor: r, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
116
+ }
117
+ /**
118
+ * Get the current editor instance.
119
+ */
120
+ getSnapshot() {
121
+ return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
122
+ }
123
+ /**
124
+ * Always disable the editor on the server-side.
125
+ */
126
+ getServerSnapshot() {
127
+ return { editor: null, transactionNumber: 0 };
128
+ }
129
+ /**
130
+ * Subscribe to the editor instance's changes.
131
+ */
132
+ subscribe(r) {
133
+ return this.subscribers.add(r), () => {
134
+ this.subscribers.delete(r);
135
+ };
136
+ }
137
+ /**
138
+ * Watch the editor instance for changes.
139
+ */
140
+ watch(r) {
141
+ if (this.editor = r, this.editor) {
142
+ const e = () => {
143
+ this.transactionNumber += 1, this.subscribers.forEach((n) => n());
144
+ }, t = this.editor;
145
+ return t.on("transaction", e), () => {
146
+ t.off("transaction", e);
147
+ };
148
+ }
149
+ }
150
+ };
151
+ function U(r) {
152
+ var e;
153
+ const [t] = p(() => new j(r.editor)), n = I.useSyncExternalStoreWithSelector(
154
+ t.subscribe,
155
+ t.getSnapshot,
156
+ t.getServerSnapshot,
157
+ r.selector,
158
+ (e = r.equalityFn) != null ? e : _
159
+ );
160
+ return V(() => t.watch(r.editor), [r.editor, t]), m(n), n;
161
+ }
162
+ var h = process.env.NODE_ENV !== "production", S = typeof window > "u", q = S || !!(typeof window < "u" && window.next), L = class E {
163
+ constructor(e) {
164
+ 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);
165
+ }
166
+ setEditor(e) {
167
+ this.editor = e, this.instanceId = Math.random().toString(36).slice(2, 9), this.subscriptions.forEach((t) => t());
168
+ }
169
+ getInitialEditor() {
170
+ const e = this.options.current.immediatelyRender;
171
+ let t = e ?? !0;
172
+ return S ? (t && h && console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"), t = !1) : q && e === void 0 && (t = !1, h && console.warn(
173
+ "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."
174
+ )), t ? this.createEditor() : null;
175
+ }
176
+ /**
177
+ * Create a new editor instance. And attach event listeners.
178
+ */
179
+ createEditor() {
180
+ const e = {
181
+ ...this.options.current,
182
+ // Always call the most recent version of the callback function by default
183
+ onBeforeCreate: (...n) => {
184
+ var i, s;
185
+ return (s = (i = this.options.current).onBeforeCreate) == null ? void 0 : s.call(i, ...n);
186
+ },
187
+ onBlur: (...n) => {
188
+ var i, s;
189
+ return (s = (i = this.options.current).onBlur) == null ? void 0 : s.call(i, ...n);
190
+ },
191
+ onCreate: (...n) => {
192
+ var i, s;
193
+ return (s = (i = this.options.current).onCreate) == null ? void 0 : s.call(i, ...n);
194
+ },
195
+ onDestroy: (...n) => {
196
+ var i, s;
197
+ return (s = (i = this.options.current).onDestroy) == null ? void 0 : s.call(i, ...n);
198
+ },
199
+ onFocus: (...n) => {
200
+ var i, s;
201
+ return (s = (i = this.options.current).onFocus) == null ? void 0 : s.call(i, ...n);
202
+ },
203
+ onSelectionUpdate: (...n) => {
204
+ var i, s;
205
+ return (s = (i = this.options.current).onSelectionUpdate) == null ? void 0 : s.call(i, ...n);
206
+ },
207
+ onTransaction: (...n) => {
208
+ var i, s;
209
+ return (s = (i = this.options.current).onTransaction) == null ? void 0 : s.call(i, ...n);
210
+ },
211
+ onUpdate: (...n) => {
212
+ var i, s;
213
+ return (s = (i = this.options.current).onUpdate) == null ? void 0 : s.call(i, ...n);
214
+ },
215
+ onContentError: (...n) => {
216
+ var i, s;
217
+ return (s = (i = this.options.current).onContentError) == null ? void 0 : s.call(i, ...n);
218
+ },
219
+ onDrop: (...n) => {
220
+ var i, s;
221
+ return (s = (i = this.options.current).onDrop) == null ? void 0 : s.call(i, ...n);
222
+ },
223
+ onPaste: (...n) => {
224
+ var i, s;
225
+ return (s = (i = this.options.current).onPaste) == null ? void 0 : s.call(i, ...n);
226
+ },
227
+ onDelete: (...n) => {
228
+ var i, s;
229
+ return (s = (i = this.options.current).onDelete) == null ? void 0 : s.call(i, ...n);
230
+ }
231
+ };
232
+ return new M(e);
233
+ }
234
+ /**
235
+ * Get the current editor instance.
236
+ */
237
+ getEditor() {
238
+ return this.editor;
239
+ }
240
+ /**
241
+ * Always disable the editor on the server-side.
242
+ */
243
+ getServerSnapshot() {
244
+ return null;
245
+ }
246
+ /**
247
+ * Subscribe to the editor instance's changes.
248
+ */
249
+ subscribe(e) {
250
+ return this.subscriptions.add(e), () => {
251
+ this.subscriptions.delete(e);
252
+ };
253
+ }
254
+ static compareOptions(e, t) {
255
+ return Object.keys(e).every((n) => [
256
+ "onCreate",
257
+ "onBeforeCreate",
258
+ "onDestroy",
259
+ "onUpdate",
260
+ "onTransaction",
261
+ "onFocus",
262
+ "onBlur",
263
+ "onSelectionUpdate",
264
+ "onContentError",
265
+ "onDrop",
266
+ "onPaste"
267
+ ].includes(n) ? !0 : n === "extensions" && e.extensions && t.extensions ? e.extensions.length !== t.extensions.length ? !1 : e.extensions.every((i, s) => {
268
+ var c;
269
+ return i === ((c = t.extensions) == null ? void 0 : c[s]);
270
+ }) : e[n] === t[n]);
271
+ }
272
+ /**
273
+ * On each render, we will create, update, or destroy the editor instance.
274
+ * @param deps The dependencies to watch for changes
275
+ * @returns A cleanup function
276
+ */
277
+ onRender(e) {
278
+ return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && e.length === 0 ? E.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({
279
+ ...this.options.current,
280
+ editable: this.editor.isEditable
281
+ }) : this.refreshEditorInstance(e), () => {
282
+ this.isComponentMounted = !1, this.scheduleDestroy();
283
+ });
284
+ }
285
+ /**
286
+ * Recreate the editor instance if the dependencies have changed.
287
+ */
288
+ refreshEditorInstance(e) {
289
+ if (this.editor && !this.editor.isDestroyed) {
290
+ if (this.previousDeps === null) {
291
+ this.previousDeps = e;
292
+ return;
293
+ }
294
+ if (this.previousDeps.length === e.length && this.previousDeps.every((n, i) => n === e[i]))
295
+ return;
296
+ }
297
+ this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), this.previousDeps = e;
298
+ }
299
+ /**
300
+ * Schedule the destruction of the editor instance.
301
+ * This will only destroy the editor if it was not mounted on the next tick.
302
+ * This is to avoid destroying the editor instance when it's actually still mounted.
303
+ */
304
+ scheduleDestroy() {
305
+ const e = this.instanceId, t = this.editor;
306
+ this.scheduledDestructionTimeout = setTimeout(() => {
307
+ if (this.isComponentMounted && this.instanceId === e) {
308
+ t && t.setOptions(this.options.current);
309
+ return;
310
+ }
311
+ t && !t.isDestroyed && (t.destroy(), this.instanceId === e && this.setEditor(null));
312
+ }, 1);
313
+ }
314
+ };
315
+ function $(r = {}, e = []) {
316
+ const t = R(r);
317
+ t.current = r;
318
+ const [n] = p(() => new L(t)), i = b.useSyncExternalStore(
319
+ n.subscribe,
320
+ n.getEditor,
321
+ n.getServerSnapshot
322
+ );
323
+ return m(i), f(n.onRender(e)), U({
324
+ editor: i,
325
+ selector: ({ transactionNumber: s }) => r.shouldRerenderOnTransaction === !1 || r.shouldRerenderOnTransaction === void 0 ? null : r.immediatelyRender && s === 0 ? 0 : s + 1
326
+ }), i;
327
+ }
328
+ var y = d({
329
+ editor: null
330
+ });
331
+ y.Consumer;
332
+ var z = d({
333
+ onDragStart: () => {
334
+ },
335
+ nodeViewContentChildren: void 0,
336
+ nodeViewContentRef: () => {
337
+ }
338
+ }), W = () => v(z);
339
+ o.forwardRef((r, e) => {
340
+ const { onDragStart: t } = W(), n = r.as || "div";
341
+ return (
342
+ // @ts-ignore
343
+ /* @__PURE__ */ a(
344
+ n,
345
+ {
346
+ ...r,
347
+ ref: e,
348
+ "data-node-view-wrapper": "",
349
+ onDragStart: t,
350
+ style: {
351
+ whiteSpace: "normal",
352
+ ...r.style
353
+ }
354
+ }
355
+ )
356
+ );
357
+ });
358
+ o.createContext({
359
+ markViewContentRef: () => {
360
+ }
361
+ });
362
+ var u = d({
363
+ get editor() {
364
+ throw new Error("useTiptap must be used within a <Tiptap> provider");
365
+ }
366
+ });
367
+ u.displayName = "TiptapContext";
368
+ var H = () => v(u);
369
+ function w({ editor: r, instance: e, children: t }) {
370
+ const n = r ?? e;
371
+ if (!n)
372
+ throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
373
+ const i = l(() => ({ editor: n }), [n]), s = l(() => ({ editor: n }), [n]);
374
+ return /* @__PURE__ */ a(y.Provider, { value: s, children: /* @__PURE__ */ a(u.Provider, { value: i, children: t }) });
375
+ }
376
+ w.displayName = "Tiptap";
377
+ function x({ ...r }) {
378
+ const { editor: e } = H();
379
+ return /* @__PURE__ */ a(F, { editor: e, ...r });
380
+ }
381
+ x.displayName = "Tiptap.Content";
382
+ Object.assign(w, {
383
+ /**
384
+ * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
385
+ * @see TiptapContent
386
+ */
387
+ Content: x
388
+ });
389
+ export {
390
+ re as CommandManager,
391
+ M as Editor,
392
+ F as EditorContent,
393
+ y as EditorContext,
394
+ ne as Extendable,
395
+ ie as Extension,
396
+ se as InputRule,
397
+ oe as MappablePosition,
398
+ ae as Mark,
399
+ de as Node,
400
+ ue as NodePos,
401
+ ce as PasteRule,
402
+ k as PureEditorContent,
403
+ z as ReactNodeViewContext,
404
+ x as TiptapContent,
405
+ u as TiptapContext,
406
+ w as TiptapWrapper,
407
+ le as callOrReturn,
408
+ he as canInsertNode,
409
+ pe as combineTransactionSteps,
410
+ me as commands,
411
+ fe as createAtomBlockMarkdownSpec,
412
+ ve as createBlockMarkdownSpec,
413
+ be as createChainableState,
414
+ ge as createDocument,
415
+ Se as createInlineMarkdownSpec,
416
+ Ee as createMappablePosition,
417
+ ye as createNodeFromContent,
418
+ we as createStyleTag,
419
+ xe as defaultBlockAt,
420
+ Re as deleteProps,
421
+ Ce as elementFromString,
422
+ Ne as extensions,
423
+ Te as findChildrenInRange,
424
+ De as findDuplicates,
425
+ Me as findParentNode,
426
+ _e as findParentNodeClosestToPos,
427
+ Ie as flattenExtensions,
428
+ Pe as fromString,
429
+ Ae as generateHTML,
430
+ Oe as generateJSON,
431
+ ke as getAttributes,
432
+ Be as getAttributesFromExtensions,
433
+ Fe as getChangedRanges,
434
+ Ve as getExtensionField,
435
+ je as getHTMLFromFragment,
436
+ Ue as getMarkAttributes,
437
+ qe as getMarkRange,
438
+ Le as getMarkType,
439
+ ze as getMarksBetween,
440
+ We as getNodeAtPosition,
441
+ He as getNodeAttributes,
442
+ Je as getNodeType,
443
+ Ke as getRenderedAttributes,
444
+ Ge as getSchema,
445
+ Qe as getSchemaByResolvedExtensions,
446
+ Xe as getSchemaTypeByName,
447
+ Ye as getSchemaTypeNameByName,
448
+ Ze as getSplittedAttributes,
449
+ $e as getText,
450
+ et as getTextBetween,
451
+ tt as getTextContentFromNodes,
452
+ rt as getTextSerializersFromSchema,
453
+ nt as getUpdatedPosition,
454
+ it as injectExtensionAttributesToParseRule,
455
+ st as inputRulesPlugin,
456
+ ot as isActive,
457
+ at as isAndroid,
458
+ dt as isAtEndOfNode,
459
+ ut as isAtStartOfNode,
460
+ ct as isEmptyObject,
461
+ lt as isExtensionRulesEnabled,
462
+ ht as isFunction,
463
+ pt as isList,
464
+ mt as isMacOS,
465
+ ft as isMarkActive,
466
+ vt as isNodeActive,
467
+ bt as isNodeEmpty,
468
+ gt as isNodeSelection,
469
+ St as isNumber,
470
+ Et as isPlainObject,
471
+ yt as isRegExp,
472
+ wt as isSafari,
473
+ xt as isTextSelection,
474
+ Rt as isiOS,
475
+ Ct as markInputRule,
476
+ Nt as markPasteRule,
477
+ Tt as markdown,
478
+ Dt as mergeAttributes,
479
+ Mt as mergeDeep,
480
+ _t as minMax,
481
+ It as nodeInputRule,
482
+ Pt as objectIncludes,
483
+ At as parseAttributes,
484
+ Ot as parseIndentedBlocks,
485
+ kt as pasteRulesPlugin,
486
+ Bt as removeDuplicates,
487
+ Ft as renderNestedMarkdownContent,
488
+ Vt as resolveExtensions,
489
+ jt as resolveFocusPosition,
490
+ Ut as selectionToInsertionEnd,
491
+ qt as serializeAttributes,
492
+ Lt as sortExtensions,
493
+ zt as splitExtensions,
494
+ Wt as textblockTypeInputRule,
495
+ Ht as updateMarkViewAttributes,
496
+ $ as useEditor,
497
+ U as useEditorState,
498
+ W as useReactNodeView,
499
+ H as useTiptap,
500
+ Jt as wrappingInputRule
501
+ };
@@ -0,0 +1,28 @@
1
+ import { Extension as e } from "../../core/dist/index.js";
2
+ import { Blockquote as n } from "../../extension-blockquote/dist/index.js";
3
+ import { Bold as p } from "../../extension-bold/dist/index.js";
4
+ import { Code as f } from "../../extension-code/dist/index.js";
5
+ import { CodeBlock as h } from "../../extension-code-block/dist/index.js";
6
+ import { Document as u } from "../../extension-document/dist/index.js";
7
+ import { HardBreak as l } from "../../extension-hard-break/dist/index.js";
8
+ import { Heading as a } from "../../extension-heading/dist/index.js";
9
+ import { HorizontalRule as c } from "../../extension-horizontal-rule/dist/index.js";
10
+ import { Italic as d } from "../../extension-italic/dist/index.js";
11
+ import { Link as m } from "../../extension-link/dist/index.js";
12
+ import { BulletList as g, ListItem as k, ListKeymap as B, OrderedList as L } from "../../extension-list/dist/index.js";
13
+ import { Paragraph as b } from "../../extension-paragraph/dist/index.js";
14
+ import { Strike as x } from "../../extension-strike/dist/index.js";
15
+ import { Text as v } from "../../extension-text/dist/index.js";
16
+ import { Underline as R } from "../../extension-underline/dist/index.js";
17
+ import { Dropcursor as K, Gapcursor as I, UndoRedo as _, TrailingNode as q } from "../../extensions/dist/index.js";
18
+ var J = e.create({
19
+ name: "starterKit",
20
+ addExtensions() {
21
+ var i, s, t, r;
22
+ const o = [];
23
+ return this.options.bold !== !1 && o.push(p.configure(this.options.bold)), this.options.blockquote !== !1 && o.push(n.configure(this.options.blockquote)), this.options.bulletList !== !1 && o.push(g.configure(this.options.bulletList)), this.options.code !== !1 && o.push(f.configure(this.options.code)), this.options.codeBlock !== !1 && o.push(h.configure(this.options.codeBlock)), this.options.document !== !1 && o.push(u.configure(this.options.document)), this.options.dropcursor !== !1 && o.push(K.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && o.push(I.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && o.push(l.configure(this.options.hardBreak)), this.options.heading !== !1 && o.push(a.configure(this.options.heading)), this.options.undoRedo !== !1 && o.push(_.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && o.push(c.configure(this.options.horizontalRule)), this.options.italic !== !1 && o.push(d.configure(this.options.italic)), this.options.listItem !== !1 && o.push(k.configure(this.options.listItem)), this.options.listKeymap !== !1 && o.push(B.configure((i = this.options) == null ? void 0 : i.listKeymap)), this.options.link !== !1 && o.push(m.configure((s = this.options) == null ? void 0 : s.link)), this.options.orderedList !== !1 && o.push(L.configure(this.options.orderedList)), this.options.paragraph !== !1 && o.push(b.configure(this.options.paragraph)), this.options.strike !== !1 && o.push(x.configure(this.options.strike)), this.options.text !== !1 && o.push(v.configure(this.options.text)), this.options.underline !== !1 && o.push(R.configure((t = this.options) == null ? void 0 : t.underline)), this.options.trailingNode !== !1 && o.push(q.configure((r = this.options) == null ? void 0 : r.trailingNode)), o;
24
+ }
25
+ });
26
+ export {
27
+ J as StarterKit
28
+ };