@lunejs/admin-ui 0.1.4 → 0.2.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 (91) hide show
  1. package/dist/_virtual/index10.js +5 -2
  2. package/dist/_virtual/index11.js +4 -0
  3. package/dist/_virtual/index6.js +3 -3
  4. package/dist/_virtual/index8.js +3 -5
  5. package/dist/lib/api/fetchers/gql-fetcher.js +6 -6
  6. package/dist/lib/collections/components/collection-details/cards/general-card.js +20 -14
  7. package/dist/lib/custom-fields/components/fields/color.js +3 -3
  8. package/dist/lib/dashboard/pages/dashboard-page.js +5 -5
  9. package/dist/lib/product/components/product-details/cards/general-product-card.js +18 -12
  10. package/dist/node_modules/@tiptap/core/dist/index.js +3562 -0
  11. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
  12. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +80 -0
  13. package/dist/node_modules/@tiptap/extension-document/dist/index.js +13 -0
  14. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +64 -0
  15. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +78 -0
  16. package/dist/node_modules/@tiptap/extension-link/dist/index.js +305 -0
  17. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  18. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +42 -0
  19. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  20. package/dist/node_modules/@tiptap/extension-text/dist/index.js +14 -0
  21. package/dist/node_modules/@tiptap/extension-text-style/dist/index.js +240 -0
  22. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +66 -0
  23. package/dist/node_modules/@tiptap/react/dist/index.js +481 -0
  24. package/dist/node_modules/eventemitter3/index.js +1 -1
  25. package/dist/node_modules/eventemitter3/index2.js +1 -1
  26. package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
  27. package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
  28. package/dist/node_modules/lucide-react/dist/esm/icons/baseline.js +10 -0
  29. package/dist/node_modules/lucide-react/dist/esm/icons/between-horizontal-end.js +10 -0
  30. package/dist/node_modules/lucide-react/dist/esm/icons/between-vertical-end.js +10 -0
  31. package/dist/node_modules/lucide-react/dist/esm/icons/bold.js +11 -0
  32. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-plus.js +16 -0
  33. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-x.js +16 -0
  34. package/dist/node_modules/lucide-react/dist/esm/icons/italic.js +10 -0
  35. package/dist/node_modules/lucide-react/dist/esm/icons/link.js +9 -0
  36. package/dist/node_modules/lucide-react/dist/esm/icons/list-ordered.js +13 -0
  37. package/dist/node_modules/lucide-react/dist/esm/icons/table-columns-split.js +18 -0
  38. package/dist/node_modules/lucide-react/dist/esm/icons/table-rows-split.js +18 -0
  39. package/dist/node_modules/lucide-react/dist/esm/icons/table.js +11 -0
  40. package/dist/node_modules/lucide-react/dist/esm/icons/underline.js +9 -0
  41. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  42. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  43. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  44. package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
  45. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  46. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  47. package/dist/node_modules/prosemirror-tables/dist/index.js +1446 -0
  48. package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
  49. package/dist/node_modules/prosemirror-view/dist/index.js +3772 -0
  50. package/dist/node_modules/react-is/index.js +1 -1
  51. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  52. package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
  53. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  54. package/dist/node_modules/w3c-keyname/index.js +93 -0
  55. package/dist/packages/lune-ui/dist/_virtual/index3.js +2 -5
  56. package/dist/packages/lune-ui/dist/_virtual/index6.js +5 -2
  57. package/dist/packages/lune-ui/dist/components/popover.js +15 -11
  58. package/dist/packages/lune-ui/dist/components/select.js +6 -6
  59. package/dist/packages/lune-ui/dist/form/form-date-picker.js +2 -2
  60. package/dist/packages/lune-ui/dist/form/form.js +4 -4
  61. package/dist/packages/lune-ui/dist/node_modules/@radix-ui/react-popover/dist/index.js +39 -38
  62. package/dist/packages/lune-ui/dist/node_modules/prop-types/index.js +1 -1
  63. package/dist/packages/lune-ui/dist/packages/lune-ui/node_modules/recharts/es6/util/Events.js +1 -1
  64. package/dist/shared/components/color-picker/color-picker.d.ts +2 -1
  65. package/dist/shared/components/color-picker/color-picker.js +11 -11
  66. package/dist/shared/components/data-table/data-table-filter.js +4 -4
  67. package/dist/shared/components/rich-editor/rich-editor.d.ts +6 -0
  68. package/dist/shared/components/rich-editor/rich-editor.js +93 -0
  69. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.d.ts +1 -0
  70. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +65 -0
  71. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.d.ts +1 -0
  72. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +65 -0
  73. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.d.ts +1 -0
  74. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +114 -0
  75. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.d.ts +1 -0
  76. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +65 -0
  77. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.d.ts +2 -0
  78. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.js +103 -0
  79. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.d.ts +1 -0
  80. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +63 -0
  81. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  82. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +65 -0
  83. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.d.ts +1 -0
  84. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +107 -0
  85. package/dist/shared/components/rich-editor/toolbar/toolbar.d.ts +1 -0
  86. package/dist/shared/components/rich-editor/toolbar/toolbar.js +64 -0
  87. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  88. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +65 -0
  89. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.d.ts +1 -0
  90. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +65 -0
  91. package/package.json +6 -1
@@ -0,0 +1,66 @@
1
+ import { Mark as d, mergeAttributes as a } from "../../core/dist/index.js";
2
+ var s = d.create({
3
+ name: "underline",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {}
7
+ };
8
+ },
9
+ parseHTML() {
10
+ return [
11
+ {
12
+ tag: "u"
13
+ },
14
+ {
15
+ style: "text-decoration",
16
+ consuming: !1,
17
+ getAttrs: (e) => e.includes("underline") ? {} : !1
18
+ }
19
+ ];
20
+ },
21
+ renderHTML({ HTMLAttributes: e }) {
22
+ return ["u", a(this.options.HTMLAttributes, e), 0];
23
+ },
24
+ parseMarkdown(e, n) {
25
+ return n.applyMark(this.name || "underline", n.parseInline(e.tokens || []));
26
+ },
27
+ renderMarkdown(e, n) {
28
+ return `++${n.renderChildren(e)}++`;
29
+ },
30
+ markdownTokenizer: {
31
+ name: "underline",
32
+ level: "inline",
33
+ start(e) {
34
+ return e.indexOf("++");
35
+ },
36
+ tokenize(e, n, i) {
37
+ const r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
38
+ if (!r)
39
+ return;
40
+ const t = r[2].trim();
41
+ return {
42
+ type: "underline",
43
+ raw: r[0],
44
+ text: t,
45
+ tokens: i.inlineTokens(t)
46
+ };
47
+ }
48
+ },
49
+ addCommands() {
50
+ return {
51
+ setUnderline: () => ({ commands: e }) => e.setMark(this.name),
52
+ toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
53
+ unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
54
+ };
55
+ },
56
+ addKeyboardShortcuts() {
57
+ return {
58
+ "Mod-u": () => this.editor.commands.toggleUnderline(),
59
+ "Mod-U": () => this.editor.commands.toggleUnderline()
60
+ };
61
+ }
62
+ }), l = s;
63
+ export {
64
+ s as Underline,
65
+ l as default
66
+ };
@@ -0,0 +1,481 @@
1
+ import o, { useContext as l, createContext as h, useRef as S, useState as p, useDebugValue as m, useEffect as f, forwardRef as C, useLayoutEffect as y } from "react";
2
+ import w from "react-dom";
3
+ import { s as b } from "../../../../_virtual/index6.js";
4
+ import { jsxs as R, Fragment as v, jsx as a } from "react/jsx-runtime";
5
+ import { Editor as x } from "../../core/dist/index.js";
6
+ import { CommandManager as Z, Extendable as $, Extension as ee, InputRule as te, MappablePosition as ne, Mark as re, Node as ie, NodePos as se, PasteRule as oe, callOrReturn as ae, combineTransactionSteps as de, commands as ue, createAtomBlockMarkdownSpec as ce, createBlockMarkdownSpec as le, createChainableState as he, createDocument as pe, createInlineMarkdownSpec as me, createMappablePosition as fe, createNodeFromContent as be, createStyleTag as ve, defaultBlockAt as Ee, deleteProps as ge, elementFromString as Se, extensions as Ce, findChildrenInRange as ye, findDuplicates as we, findParentNode as Re, findParentNodeClosestToPos as xe, flattenExtensions as Ne, fromString as De, getAttributes as Te, getAttributesFromExtensions as _e, getChangedRanges as Me, getExtensionField as Ie, getHTMLFromFragment as Ae, getMarkAttributes as Pe, getMarkRange as Oe, getMarkType as ke, getMarksBetween as Be, getNodeAtPosition as Fe, getNodeAttributes as Ve, getNodeType as ze, getRenderedAttributes as Ue, getSchemaByResolvedExtensions as je, getSchemaTypeByName as qe, getSchemaTypeNameByName as Le, getSplittedAttributes as We, getText as He, getTextBetween as Ke, getTextContentFromNodes as Ge, getTextSerializersFromSchema as Je, getUpdatedPosition as Qe, injectExtensionAttributesToParseRule as Xe, inputRulesPlugin as Ye, isActive as Ze, isAndroid as $e, isAtEndOfNode as et, isAtStartOfNode as tt, isEmptyObject as nt, isExtensionRulesEnabled as rt, isFunction as it, isList as st, isMacOS as ot, isMarkActive as at, isNodeActive as dt, isNodeEmpty as ut, isNumber as ct, isPlainObject as lt, isRegExp as ht, isTextSelection as pt, isiOS as mt, markInputRule as ft, markPasteRule as bt, markdown as vt, mergeAttributes as Et, mergeDeep as gt, minMax as St, objectIncludes as Ct, parseAttributes as yt, parseIndentedBlocks as wt, pasteRulesPlugin as Rt, removeDuplicates as xt, renderNestedMarkdownContent as Nt, resolveExtensions as Dt, resolveFocusPosition as Tt, selectionToInsertionEnd as _t, serializeAttributes as Mt, sortExtensions as It, splitExtensions as At, textblockTypeInputRule as Pt, updateMarkViewAttributes as Ot, wrappingInputRule as kt } from "../../core/dist/index.js";
7
+ import { deepEqual as N } from "../../../fast-equals/dist/es/index.js";
8
+ import { w as D } from "../../../../_virtual/with-selector.js";
9
+ var T = (...r) => (e) => {
10
+ r.forEach((t) => {
11
+ typeof t == "function" ? t(e) : t && (t.current = e);
12
+ });
13
+ }, _ = ({ contentComponent: r }) => {
14
+ const e = b.useSyncExternalStore(
15
+ r.subscribe,
16
+ r.getSnapshot,
17
+ r.getServerSnapshot
18
+ );
19
+ return /* @__PURE__ */ a(v, { children: Object.values(e) });
20
+ };
21
+ function M() {
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]: w.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 I = class extends o.Component {
58
+ constructor(r) {
59
+ var e;
60
+ super(r), this.editorContentRef = o.createRef(), this.initialized = !1, this.state = {
61
+ hasContentComponentInitialized: !!((e = r.editor) != null && e.contentComponent)
62
+ };
63
+ }
64
+ componentDidMount() {
65
+ this.init();
66
+ }
67
+ componentDidUpdate() {
68
+ this.init();
69
+ }
70
+ init() {
71
+ var r;
72
+ const e = this.props.editor;
73
+ if (e && !e.isDestroyed && ((r = e.view.dom) != null && r.parentNode)) {
74
+ if (e.contentComponent)
75
+ return;
76
+ const t = this.editorContentRef.current;
77
+ t.append(...e.view.dom.parentNode.childNodes), e.setOptions({
78
+ element: t
79
+ }), e.contentComponent = M(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = e.contentComponent.subscribe(() => {
80
+ this.setState((n) => n.hasContentComponentInitialized ? n : {
81
+ hasContentComponentInitialized: !0
82
+ }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
83
+ })), e.createNodeViews(), this.initialized = !0;
84
+ }
85
+ }
86
+ componentWillUnmount() {
87
+ var r;
88
+ const e = this.props.editor;
89
+ if (e) {
90
+ this.initialized = !1, e.isDestroyed || e.view.setProps({
91
+ nodeViews: {}
92
+ }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), e.contentComponent = null;
93
+ try {
94
+ if (!((r = e.view.dom) != null && r.parentNode))
95
+ return;
96
+ const t = document.createElement("div");
97
+ t.append(...e.view.dom.parentNode.childNodes), e.setOptions({
98
+ element: t
99
+ });
100
+ } catch {
101
+ }
102
+ }
103
+ }
104
+ render() {
105
+ const { editor: r, innerRef: e, ...t } = this.props;
106
+ return /* @__PURE__ */ R(v, { children: [
107
+ /* @__PURE__ */ a("div", { ref: T(e, this.editorContentRef), ...t }),
108
+ r?.contentComponent && /* @__PURE__ */ a(_, { contentComponent: r.contentComponent })
109
+ ] });
110
+ }
111
+ }, A = C(
112
+ (r, e) => {
113
+ const t = o.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [r.editor]);
114
+ return o.createElement(I, {
115
+ key: t,
116
+ innerRef: e,
117
+ ...r
118
+ });
119
+ }
120
+ ), G = o.memo(A), P = typeof window < "u" ? y : f, O = class {
121
+ constructor(r) {
122
+ 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);
123
+ }
124
+ /**
125
+ * Get the current editor instance.
126
+ */
127
+ getSnapshot() {
128
+ return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
129
+ }
130
+ /**
131
+ * Always disable the editor on the server-side.
132
+ */
133
+ getServerSnapshot() {
134
+ return { editor: null, transactionNumber: 0 };
135
+ }
136
+ /**
137
+ * Subscribe to the editor instance's changes.
138
+ */
139
+ subscribe(r) {
140
+ return this.subscribers.add(r), () => {
141
+ this.subscribers.delete(r);
142
+ };
143
+ }
144
+ /**
145
+ * Watch the editor instance for changes.
146
+ */
147
+ watch(r) {
148
+ if (this.editor = r, this.editor) {
149
+ const e = () => {
150
+ this.transactionNumber += 1, this.subscribers.forEach((n) => n());
151
+ }, t = this.editor;
152
+ return t.on("transaction", e), () => {
153
+ t.off("transaction", e);
154
+ };
155
+ }
156
+ }
157
+ };
158
+ function k(r) {
159
+ var e;
160
+ const [t] = p(() => new O(r.editor)), n = D.useSyncExternalStoreWithSelector(
161
+ t.subscribe,
162
+ t.getSnapshot,
163
+ t.getServerSnapshot,
164
+ r.selector,
165
+ (e = r.equalityFn) != null ? e : N
166
+ );
167
+ return P(() => t.watch(r.editor), [r.editor, t]), m(n), n;
168
+ }
169
+ var c = process.env.NODE_ENV !== "production", d = typeof window > "u", B = d || !!(typeof window < "u" && window.next), F = class E {
170
+ constructor(e) {
171
+ 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);
172
+ }
173
+ setEditor(e) {
174
+ this.editor = e, this.instanceId = Math.random().toString(36).slice(2, 9), this.subscriptions.forEach((t) => t());
175
+ }
176
+ getInitialEditor() {
177
+ if (this.options.current.immediatelyRender === void 0) {
178
+ if (d || B) {
179
+ if (c)
180
+ throw new Error(
181
+ "Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."
182
+ );
183
+ return null;
184
+ }
185
+ return this.createEditor();
186
+ }
187
+ if (this.options.current.immediatelyRender && d && c)
188
+ throw new Error(
189
+ "Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches."
190
+ );
191
+ return this.options.current.immediatelyRender ? this.createEditor() : null;
192
+ }
193
+ /**
194
+ * Create a new editor instance. And attach event listeners.
195
+ */
196
+ createEditor() {
197
+ const e = {
198
+ ...this.options.current,
199
+ // Always call the most recent version of the callback function by default
200
+ onBeforeCreate: (...n) => {
201
+ var i, s;
202
+ return (s = (i = this.options.current).onBeforeCreate) == null ? void 0 : s.call(i, ...n);
203
+ },
204
+ onBlur: (...n) => {
205
+ var i, s;
206
+ return (s = (i = this.options.current).onBlur) == null ? void 0 : s.call(i, ...n);
207
+ },
208
+ onCreate: (...n) => {
209
+ var i, s;
210
+ return (s = (i = this.options.current).onCreate) == null ? void 0 : s.call(i, ...n);
211
+ },
212
+ onDestroy: (...n) => {
213
+ var i, s;
214
+ return (s = (i = this.options.current).onDestroy) == null ? void 0 : s.call(i, ...n);
215
+ },
216
+ onFocus: (...n) => {
217
+ var i, s;
218
+ return (s = (i = this.options.current).onFocus) == null ? void 0 : s.call(i, ...n);
219
+ },
220
+ onSelectionUpdate: (...n) => {
221
+ var i, s;
222
+ return (s = (i = this.options.current).onSelectionUpdate) == null ? void 0 : s.call(i, ...n);
223
+ },
224
+ onTransaction: (...n) => {
225
+ var i, s;
226
+ return (s = (i = this.options.current).onTransaction) == null ? void 0 : s.call(i, ...n);
227
+ },
228
+ onUpdate: (...n) => {
229
+ var i, s;
230
+ return (s = (i = this.options.current).onUpdate) == null ? void 0 : s.call(i, ...n);
231
+ },
232
+ onContentError: (...n) => {
233
+ var i, s;
234
+ return (s = (i = this.options.current).onContentError) == null ? void 0 : s.call(i, ...n);
235
+ },
236
+ onDrop: (...n) => {
237
+ var i, s;
238
+ return (s = (i = this.options.current).onDrop) == null ? void 0 : s.call(i, ...n);
239
+ },
240
+ onPaste: (...n) => {
241
+ var i, s;
242
+ return (s = (i = this.options.current).onPaste) == null ? void 0 : s.call(i, ...n);
243
+ },
244
+ onDelete: (...n) => {
245
+ var i, s;
246
+ return (s = (i = this.options.current).onDelete) == null ? void 0 : s.call(i, ...n);
247
+ }
248
+ };
249
+ return new x(e);
250
+ }
251
+ /**
252
+ * Get the current editor instance.
253
+ */
254
+ getEditor() {
255
+ return this.editor;
256
+ }
257
+ /**
258
+ * Always disable the editor on the server-side.
259
+ */
260
+ getServerSnapshot() {
261
+ return null;
262
+ }
263
+ /**
264
+ * Subscribe to the editor instance's changes.
265
+ */
266
+ subscribe(e) {
267
+ return this.subscriptions.add(e), () => {
268
+ this.subscriptions.delete(e);
269
+ };
270
+ }
271
+ static compareOptions(e, t) {
272
+ return Object.keys(e).every((n) => [
273
+ "onCreate",
274
+ "onBeforeCreate",
275
+ "onDestroy",
276
+ "onUpdate",
277
+ "onTransaction",
278
+ "onFocus",
279
+ "onBlur",
280
+ "onSelectionUpdate",
281
+ "onContentError",
282
+ "onDrop",
283
+ "onPaste"
284
+ ].includes(n) ? !0 : n === "extensions" && e.extensions && t.extensions ? e.extensions.length !== t.extensions.length ? !1 : e.extensions.every((i, s) => {
285
+ var u;
286
+ return i === ((u = t.extensions) == null ? void 0 : u[s]);
287
+ }) : e[n] === t[n]);
288
+ }
289
+ /**
290
+ * On each render, we will create, update, or destroy the editor instance.
291
+ * @param deps The dependencies to watch for changes
292
+ * @returns A cleanup function
293
+ */
294
+ onRender(e) {
295
+ 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({
296
+ ...this.options.current,
297
+ editable: this.editor.isEditable
298
+ }) : this.refreshEditorInstance(e), () => {
299
+ this.isComponentMounted = !1, this.scheduleDestroy();
300
+ });
301
+ }
302
+ /**
303
+ * Recreate the editor instance if the dependencies have changed.
304
+ */
305
+ refreshEditorInstance(e) {
306
+ if (this.editor && !this.editor.isDestroyed) {
307
+ if (this.previousDeps === null) {
308
+ this.previousDeps = e;
309
+ return;
310
+ }
311
+ if (this.previousDeps.length === e.length && this.previousDeps.every((n, i) => n === e[i]))
312
+ return;
313
+ }
314
+ this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), this.previousDeps = e;
315
+ }
316
+ /**
317
+ * Schedule the destruction of the editor instance.
318
+ * This will only destroy the editor if it was not mounted on the next tick.
319
+ * This is to avoid destroying the editor instance when it's actually still mounted.
320
+ */
321
+ scheduleDestroy() {
322
+ const e = this.instanceId, t = this.editor;
323
+ this.scheduledDestructionTimeout = setTimeout(() => {
324
+ if (this.isComponentMounted && this.instanceId === e) {
325
+ t && t.setOptions(this.options.current);
326
+ return;
327
+ }
328
+ t && !t.isDestroyed && (t.destroy(), this.instanceId === e && this.setEditor(null));
329
+ }, 1);
330
+ }
331
+ };
332
+ function J(r = {}, e = []) {
333
+ const t = S(r);
334
+ t.current = r;
335
+ const [n] = p(() => new F(t)), i = b.useSyncExternalStore(
336
+ n.subscribe,
337
+ n.getEditor,
338
+ n.getServerSnapshot
339
+ );
340
+ return m(i), f(n.onRender(e)), k({
341
+ editor: i,
342
+ selector: ({ transactionNumber: s }) => r.shouldRerenderOnTransaction === !1 || r.shouldRerenderOnTransaction === void 0 ? null : r.immediatelyRender && s === 0 ? 0 : s + 1
343
+ }), i;
344
+ }
345
+ var g = h({
346
+ editor: null
347
+ });
348
+ g.Consumer;
349
+ var Q = () => l(g), V = h({
350
+ onDragStart: () => {
351
+ },
352
+ nodeViewContentChildren: void 0,
353
+ nodeViewContentRef: () => {
354
+ }
355
+ }), z = () => l(V);
356
+ o.forwardRef((r, e) => {
357
+ const { onDragStart: t } = z(), n = r.as || "div";
358
+ return (
359
+ // @ts-ignore
360
+ /* @__PURE__ */ a(
361
+ n,
362
+ {
363
+ ...r,
364
+ ref: e,
365
+ "data-node-view-wrapper": "",
366
+ onDragStart: t,
367
+ style: {
368
+ whiteSpace: "normal",
369
+ ...r.style
370
+ }
371
+ }
372
+ )
373
+ );
374
+ });
375
+ o.createContext({
376
+ markViewContentRef: () => {
377
+ }
378
+ });
379
+ export {
380
+ Z as CommandManager,
381
+ x as Editor,
382
+ G as EditorContent,
383
+ g as EditorContext,
384
+ $ as Extendable,
385
+ ee as Extension,
386
+ te as InputRule,
387
+ ne as MappablePosition,
388
+ re as Mark,
389
+ ie as Node,
390
+ se as NodePos,
391
+ oe as PasteRule,
392
+ I as PureEditorContent,
393
+ V as ReactNodeViewContext,
394
+ ae as callOrReturn,
395
+ de as combineTransactionSteps,
396
+ ue as commands,
397
+ ce as createAtomBlockMarkdownSpec,
398
+ le as createBlockMarkdownSpec,
399
+ he as createChainableState,
400
+ pe as createDocument,
401
+ me as createInlineMarkdownSpec,
402
+ fe as createMappablePosition,
403
+ be as createNodeFromContent,
404
+ ve as createStyleTag,
405
+ Ee as defaultBlockAt,
406
+ ge as deleteProps,
407
+ Se as elementFromString,
408
+ Ce as extensions,
409
+ ye as findChildrenInRange,
410
+ we as findDuplicates,
411
+ Re as findParentNode,
412
+ xe as findParentNodeClosestToPos,
413
+ Ne as flattenExtensions,
414
+ De as fromString,
415
+ Te as getAttributes,
416
+ _e as getAttributesFromExtensions,
417
+ Me as getChangedRanges,
418
+ Ie as getExtensionField,
419
+ Ae as getHTMLFromFragment,
420
+ Pe as getMarkAttributes,
421
+ Oe as getMarkRange,
422
+ ke as getMarkType,
423
+ Be as getMarksBetween,
424
+ Fe as getNodeAtPosition,
425
+ Ve as getNodeAttributes,
426
+ ze as getNodeType,
427
+ Ue as getRenderedAttributes,
428
+ je as getSchemaByResolvedExtensions,
429
+ qe as getSchemaTypeByName,
430
+ Le as getSchemaTypeNameByName,
431
+ We as getSplittedAttributes,
432
+ He as getText,
433
+ Ke as getTextBetween,
434
+ Ge as getTextContentFromNodes,
435
+ Je as getTextSerializersFromSchema,
436
+ Qe as getUpdatedPosition,
437
+ Xe as injectExtensionAttributesToParseRule,
438
+ Ye as inputRulesPlugin,
439
+ Ze as isActive,
440
+ $e as isAndroid,
441
+ et as isAtEndOfNode,
442
+ tt as isAtStartOfNode,
443
+ nt as isEmptyObject,
444
+ rt as isExtensionRulesEnabled,
445
+ it as isFunction,
446
+ st as isList,
447
+ ot as isMacOS,
448
+ at as isMarkActive,
449
+ dt as isNodeActive,
450
+ ut as isNodeEmpty,
451
+ ct as isNumber,
452
+ lt as isPlainObject,
453
+ ht as isRegExp,
454
+ pt as isTextSelection,
455
+ mt as isiOS,
456
+ ft as markInputRule,
457
+ bt as markPasteRule,
458
+ vt as markdown,
459
+ Et as mergeAttributes,
460
+ gt as mergeDeep,
461
+ St as minMax,
462
+ Ct as objectIncludes,
463
+ yt as parseAttributes,
464
+ wt as parseIndentedBlocks,
465
+ Rt as pasteRulesPlugin,
466
+ xt as removeDuplicates,
467
+ Nt as renderNestedMarkdownContent,
468
+ Dt as resolveExtensions,
469
+ Tt as resolveFocusPosition,
470
+ _t as selectionToInsertionEnd,
471
+ Mt as serializeAttributes,
472
+ It as sortExtensions,
473
+ At as splitExtensions,
474
+ Pt as textblockTypeInputRule,
475
+ Ot as updateMarkViewAttributes,
476
+ Q as useCurrentEditor,
477
+ J as useEditor,
478
+ k as useEditorState,
479
+ z as useReactNodeView,
480
+ kt as wrappingInputRule
481
+ };
@@ -1,4 +1,4 @@
1
- import e from "../../_virtual/index8.js";
1
+ import e from "../../_virtual/index10.js";
2
2
  export {
3
3
  e as EventEmitter,
4
4
  e as default
@@ -1,4 +1,4 @@
1
- import { __module as x } from "../../_virtual/index10.js";
1
+ import { __module as x } from "../../_virtual/index11.js";
2
2
  var w;
3
3
  function O() {
4
4
  return w ? x.exports : (w = 1, (function(d) {