@react-email/editor 0.0.0-experimental.8 → 1.0.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 (92) hide show
  1. package/dist/columns-BItFgD76.mjs +273 -0
  2. package/dist/columns-BItFgD76.mjs.map +1 -0
  3. package/dist/columns-DqFvXgmK.cjs +394 -0
  4. package/dist/core/index.cjs +10 -0
  5. package/dist/core/index.d.cts +2 -0
  6. package/dist/core/index.d.mts +2 -0
  7. package/dist/core/index.mjs +4 -0
  8. package/dist/core-CbSTyrV4.mjs +151 -0
  9. package/dist/core-CbSTyrV4.mjs.map +1 -0
  10. package/dist/core-D7AzzMLI.cjs +167 -0
  11. package/dist/email-node-B-_g4X-S.mjs +254 -0
  12. package/dist/email-node-B-_g4X-S.mjs.map +1 -0
  13. package/dist/email-node-hLU5bGnX.cjs +288 -0
  14. package/dist/event-bus-CIJ___tH.cjs +65 -0
  15. package/dist/event-bus-CqrIUE24.mjs +55 -0
  16. package/dist/event-bus-CqrIUE24.mjs.map +1 -0
  17. package/dist/extension-BbjpP9mF.cjs +1625 -0
  18. package/dist/extension-C5qNDPZL.mjs +154 -0
  19. package/dist/extension-C5qNDPZL.mjs.map +1 -0
  20. package/dist/extension-Cs4Yq2gF.cjs +158 -0
  21. package/dist/extension-DlWknmE5.mjs +1495 -0
  22. package/dist/extension-DlWknmE5.mjs.map +1 -0
  23. package/dist/extensions/index.cjs +50 -0
  24. package/dist/extensions/index.d.cts +392 -0
  25. package/dist/extensions/index.d.cts.map +1 -0
  26. package/dist/extensions/index.d.mts +392 -0
  27. package/dist/extensions/index.d.mts.map +1 -0
  28. package/dist/extensions/index.mjs +4 -0
  29. package/dist/extensions-CHIQO3d-.mjs +1745 -0
  30. package/dist/extensions-CHIQO3d-.mjs.map +1 -0
  31. package/dist/extensions-DCrDvZ42.cjs +1981 -0
  32. package/dist/global-content-0-J-Te3N.mjs +77 -0
  33. package/dist/global-content-0-J-Te3N.mjs.map +1 -0
  34. package/dist/global-content-8M2KyrOL.cjs +87 -0
  35. package/dist/image-KwEYzhji.cjs +41 -0
  36. package/dist/image-Oc789YjV.mjs +37 -0
  37. package/dist/image-Oc789YjV.mjs.map +1 -0
  38. package/dist/index-CHAPu71g.d.cts +193 -0
  39. package/dist/index-CHAPu71g.d.cts.map +1 -0
  40. package/dist/index-D4UEWmJX.d.mts +193 -0
  41. package/dist/index-D4UEWmJX.d.mts.map +1 -0
  42. package/dist/index.cjs +216 -0
  43. package/dist/index.d.cts +38 -0
  44. package/dist/index.d.cts.map +1 -0
  45. package/dist/index.d.mts +33 -623
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +189 -2349
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/plugins/index.cjs +56 -0
  50. package/dist/plugins/index.d.cts +114 -0
  51. package/dist/plugins/index.d.cts.map +1 -0
  52. package/dist/plugins/index.d.mts +114 -0
  53. package/dist/plugins/index.d.mts.map +1 -0
  54. package/dist/plugins/index.mjs +34 -0
  55. package/dist/plugins/index.mjs.map +1 -0
  56. package/dist/root-CT5d4CKj.cjs +2798 -0
  57. package/dist/root-uvdshbyT.mjs +2295 -0
  58. package/dist/root-uvdshbyT.mjs.map +1 -0
  59. package/dist/set-text-alignment-BCRnE5So.mjs +19 -0
  60. package/dist/set-text-alignment-BCRnE5So.mjs.map +1 -0
  61. package/dist/set-text-alignment-Twg1EG4-.cjs +22 -0
  62. package/dist/style.css +974 -0
  63. package/dist/types-BG5XsXt9.d.mts +37 -0
  64. package/dist/types-BG5XsXt9.d.mts.map +1 -0
  65. package/dist/types-DnOcnDoO.d.mts +56 -0
  66. package/dist/types-DnOcnDoO.d.mts.map +1 -0
  67. package/dist/types-DzPTbbDC.d.cts +56 -0
  68. package/dist/types-DzPTbbDC.d.cts.map +1 -0
  69. package/dist/types-hURXpEIO.d.cts +37 -0
  70. package/dist/types-hURXpEIO.d.cts.map +1 -0
  71. package/dist/ui/bubble-menu/bubble-menu.css +291 -0
  72. package/dist/ui/index.cjs +2899 -0
  73. package/dist/ui/index.d.cts +1155 -0
  74. package/dist/ui/index.d.cts.map +1 -0
  75. package/dist/ui/index.d.mts +1157 -0
  76. package/dist/ui/index.d.mts.map +1 -0
  77. package/dist/ui/index.mjs +2788 -0
  78. package/dist/ui/index.mjs.map +1 -0
  79. package/dist/ui/inspector/inspector.css +293 -0
  80. package/dist/ui/slash-command/slash-command.css +44 -0
  81. package/dist/ui/themes/default.css +1140 -0
  82. package/dist/utils/index.cjs +3 -0
  83. package/dist/utils/index.d.cts +7 -0
  84. package/dist/utils/index.d.cts.map +1 -0
  85. package/dist/utils/index.d.mts +7 -0
  86. package/dist/utils/index.d.mts.map +1 -0
  87. package/dist/utils/index.mjs +2 -0
  88. package/package.json +100 -16
  89. package/readme.md +69 -0
  90. package/dist/index.d.ts +0 -628
  91. package/dist/index.d.ts.map +0 -1
  92. package/dist/index.js +0 -2461
@@ -0,0 +1,2798 @@
1
+ const require_columns = require("./columns-DqFvXgmK.cjs");
2
+ const require_event_bus = require("./event-bus-CIJ___tH.cjs");
3
+ const require_set_text_alignment = require("./set-text-alignment-Twg1EG4-.cjs");
4
+ let _tiptap_react = require("@tiptap/react");
5
+ let react = require("react");
6
+ react = require_columns.__toESM(react);
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ let _tiptap_pm_state = require("@tiptap/pm/state");
9
+ let _tiptap_react_menus = require("@tiptap/react/menus");
10
+ let _radix_ui_react_popover = require("@radix-ui/react-popover");
11
+ _radix_ui_react_popover = require_columns.__toESM(_radix_ui_react_popover);
12
+ let _floating_ui_react_dom = require("@floating-ui/react-dom");
13
+ let _tiptap_suggestion = require("@tiptap/suggestion");
14
+ _tiptap_suggestion = require_columns.__toESM(_tiptap_suggestion);
15
+ let react_dom = require("react-dom");
16
+ //#region src/ui/icons/align-center.tsx
17
+ function AlignCenterIcon({ size, width, height, ...props }) {
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
19
+ xmlns: "http://www.w3.org/2000/svg",
20
+ width: size ?? width ?? 24,
21
+ height: size ?? height ?? 24,
22
+ viewBox: "0 0 24 24",
23
+ fill: "none",
24
+ stroke: "currentColor",
25
+ strokeWidth: 2,
26
+ strokeLinecap: "round",
27
+ strokeLinejoin: "round",
28
+ "aria-hidden": "true",
29
+ ...props,
30
+ children: [
31
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 12H7" }),
33
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 19H5" })
34
+ ]
35
+ });
36
+ }
37
+ //#endregion
38
+ //#region src/ui/icons/align-left.tsx
39
+ function AlignLeftIcon({ size, width, height, ...props }) {
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ width: size ?? width ?? 24,
43
+ height: size ?? height ?? 24,
44
+ viewBox: "0 0 24 24",
45
+ fill: "none",
46
+ stroke: "currentColor",
47
+ strokeWidth: 2,
48
+ strokeLinecap: "round",
49
+ strokeLinejoin: "round",
50
+ "aria-hidden": "true",
51
+ ...props,
52
+ children: [
53
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
54
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 12H3" }),
55
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 19H3" })
56
+ ]
57
+ });
58
+ }
59
+ //#endregion
60
+ //#region src/ui/icons/align-right.tsx
61
+ function AlignRightIcon({ size, width, height, ...props }) {
62
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
63
+ xmlns: "http://www.w3.org/2000/svg",
64
+ width: size ?? width ?? 24,
65
+ height: size ?? height ?? 24,
66
+ viewBox: "0 0 24 24",
67
+ fill: "none",
68
+ stroke: "currentColor",
69
+ strokeWidth: 2,
70
+ strokeLinecap: "round",
71
+ strokeLinejoin: "round",
72
+ "aria-hidden": "true",
73
+ ...props,
74
+ children: [
75
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
76
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 12H9" }),
77
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 19H7" })
78
+ ]
79
+ });
80
+ }
81
+ //#endregion
82
+ //#region src/ui/icons/bold.tsx
83
+ function BoldIcon({ size, width, height, ...props }) {
84
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
85
+ xmlns: "http://www.w3.org/2000/svg",
86
+ width: size ?? width ?? 24,
87
+ height: size ?? height ?? 24,
88
+ viewBox: "0 0 24 24",
89
+ fill: "none",
90
+ stroke: "currentColor",
91
+ strokeWidth: 2,
92
+ strokeLinecap: "round",
93
+ strokeLinejoin: "round",
94
+ "aria-hidden": "true",
95
+ ...props,
96
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" })
97
+ });
98
+ }
99
+ //#endregion
100
+ //#region src/ui/icons/case-upper.tsx
101
+ function CaseUpperIcon({ size, width, height, ...props }) {
102
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
103
+ xmlns: "http://www.w3.org/2000/svg",
104
+ width: size ?? width ?? 24,
105
+ height: size ?? height ?? 24,
106
+ viewBox: "0 0 24 24",
107
+ fill: "none",
108
+ stroke: "currentColor",
109
+ strokeWidth: 2,
110
+ strokeLinecap: "round",
111
+ strokeLinejoin: "round",
112
+ "aria-hidden": "true",
113
+ ...props,
114
+ children: [
115
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 11h4.5a1 1 0 0 1 0 5h-4a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h3a1 1 0 0 1 0 5" }),
116
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16" }),
117
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.304 13h6.392" })
118
+ ]
119
+ });
120
+ }
121
+ //#endregion
122
+ //#region src/ui/icons/check.tsx
123
+ function CheckIcon({ size, width, height, ...props }) {
124
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
125
+ xmlns: "http://www.w3.org/2000/svg",
126
+ width: size ?? width ?? 24,
127
+ height: size ?? height ?? 24,
128
+ viewBox: "0 0 24 24",
129
+ fill: "none",
130
+ stroke: "currentColor",
131
+ strokeWidth: 2,
132
+ strokeLinecap: "round",
133
+ strokeLinejoin: "round",
134
+ "aria-hidden": "true",
135
+ ...props,
136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M20 6 9 17l-5-5" })
137
+ });
138
+ }
139
+ //#endregion
140
+ //#region src/ui/icons/chevron-down.tsx
141
+ function ChevronDownIcon({ size, width, height, ...props }) {
142
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
143
+ xmlns: "http://www.w3.org/2000/svg",
144
+ width: size ?? width ?? 24,
145
+ height: size ?? height ?? 24,
146
+ viewBox: "0 0 24 24",
147
+ fill: "none",
148
+ stroke: "currentColor",
149
+ strokeWidth: 2,
150
+ strokeLinecap: "round",
151
+ strokeLinejoin: "round",
152
+ "aria-hidden": "true",
153
+ ...props,
154
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 9 6 6 6-6" })
155
+ });
156
+ }
157
+ //#endregion
158
+ //#region src/ui/icons/code.tsx
159
+ function CodeIcon({ size, width, height, ...props }) {
160
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
161
+ xmlns: "http://www.w3.org/2000/svg",
162
+ width: size ?? width ?? 24,
163
+ height: size ?? height ?? 24,
164
+ viewBox: "0 0 24 24",
165
+ fill: "none",
166
+ stroke: "currentColor",
167
+ strokeWidth: 2,
168
+ strokeLinecap: "round",
169
+ strokeLinejoin: "round",
170
+ "aria-hidden": "true",
171
+ ...props,
172
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m16 18 6-6-6-6" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m8 6-6 6 6 6" })]
173
+ });
174
+ }
175
+ //#endregion
176
+ //#region src/ui/icons/columns-2.tsx
177
+ function Columns2Icon({ size, width, height, ...props }) {
178
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
179
+ xmlns: "http://www.w3.org/2000/svg",
180
+ width: size ?? width ?? 24,
181
+ height: size ?? height ?? 24,
182
+ viewBox: "0 0 24 24",
183
+ fill: "none",
184
+ stroke: "currentColor",
185
+ strokeWidth: 2,
186
+ strokeLinecap: "round",
187
+ strokeLinejoin: "round",
188
+ "aria-hidden": "true",
189
+ ...props,
190
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
191
+ width: "18",
192
+ height: "18",
193
+ x: "3",
194
+ y: "3",
195
+ rx: "2"
196
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 3v18" })]
197
+ });
198
+ }
199
+ //#endregion
200
+ //#region src/ui/icons/columns-3.tsx
201
+ function Columns3Icon({ size, width, height, ...props }) {
202
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
203
+ xmlns: "http://www.w3.org/2000/svg",
204
+ width: size ?? width ?? 24,
205
+ height: size ?? height ?? 24,
206
+ viewBox: "0 0 24 24",
207
+ fill: "none",
208
+ stroke: "currentColor",
209
+ strokeWidth: 2,
210
+ strokeLinecap: "round",
211
+ strokeLinejoin: "round",
212
+ "aria-hidden": "true",
213
+ ...props,
214
+ children: [
215
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
216
+ width: "18",
217
+ height: "18",
218
+ x: "3",
219
+ y: "3",
220
+ rx: "2"
221
+ }),
222
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 3v18" }),
223
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 3v18" })
224
+ ]
225
+ });
226
+ }
227
+ //#endregion
228
+ //#region src/ui/icons/columns-4.tsx
229
+ function Columns4Icon({ size, width, height, ...props }) {
230
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
231
+ xmlns: "http://www.w3.org/2000/svg",
232
+ width: size ?? width ?? 24,
233
+ height: size ?? height ?? 24,
234
+ viewBox: "0 0 24 24",
235
+ fill: "none",
236
+ stroke: "currentColor",
237
+ strokeWidth: 2,
238
+ strokeLinecap: "round",
239
+ strokeLinejoin: "round",
240
+ "aria-hidden": "true",
241
+ ...props,
242
+ children: [
243
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
244
+ width: "18",
245
+ height: "18",
246
+ x: "3",
247
+ y: "3",
248
+ rx: "2"
249
+ }),
250
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7.5 3v18" }),
251
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 3v18" }),
252
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16.5 3v18" })
253
+ ]
254
+ });
255
+ }
256
+ //#endregion
257
+ //#region src/ui/icons/external-link.tsx
258
+ function ExternalLinkIcon({ size, width, height, ...props }) {
259
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
260
+ xmlns: "http://www.w3.org/2000/svg",
261
+ width: size ?? width ?? 24,
262
+ height: size ?? height ?? 24,
263
+ viewBox: "0 0 24 24",
264
+ fill: "none",
265
+ stroke: "currentColor",
266
+ strokeWidth: 2,
267
+ strokeLinecap: "round",
268
+ strokeLinejoin: "round",
269
+ "aria-hidden": "true",
270
+ ...props,
271
+ children: [
272
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 3h6v6" }),
273
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 14 21 3" }),
274
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
275
+ ]
276
+ });
277
+ }
278
+ //#endregion
279
+ //#region src/ui/icons/heading-1.tsx
280
+ function Heading1Icon({ size, width, height, ...props }) {
281
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
282
+ xmlns: "http://www.w3.org/2000/svg",
283
+ width: size ?? width ?? 24,
284
+ height: size ?? height ?? 24,
285
+ viewBox: "0 0 24 24",
286
+ fill: "none",
287
+ stroke: "currentColor",
288
+ strokeWidth: 2,
289
+ strokeLinecap: "round",
290
+ strokeLinejoin: "round",
291
+ "aria-hidden": "true",
292
+ ...props,
293
+ children: [
294
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 12h8" }),
295
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 18V6" }),
296
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 18V6" }),
297
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m17 12 3-2v8" })
298
+ ]
299
+ });
300
+ }
301
+ //#endregion
302
+ //#region src/ui/icons/heading-2.tsx
303
+ function Heading2Icon({ size, width, height, ...props }) {
304
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
305
+ xmlns: "http://www.w3.org/2000/svg",
306
+ width: size ?? width ?? 24,
307
+ height: size ?? height ?? 24,
308
+ viewBox: "0 0 24 24",
309
+ fill: "none",
310
+ stroke: "currentColor",
311
+ strokeWidth: 2,
312
+ strokeLinecap: "round",
313
+ strokeLinejoin: "round",
314
+ "aria-hidden": "true",
315
+ ...props,
316
+ children: [
317
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 12h8" }),
318
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 18V6" }),
319
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 18V6" }),
320
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1" })
321
+ ]
322
+ });
323
+ }
324
+ //#endregion
325
+ //#region src/ui/icons/heading-3.tsx
326
+ function Heading3Icon({ size, width, height, ...props }) {
327
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
328
+ xmlns: "http://www.w3.org/2000/svg",
329
+ width: size ?? width ?? 24,
330
+ height: size ?? height ?? 24,
331
+ viewBox: "0 0 24 24",
332
+ fill: "none",
333
+ stroke: "currentColor",
334
+ strokeWidth: 2,
335
+ strokeLinecap: "round",
336
+ strokeLinejoin: "round",
337
+ "aria-hidden": "true",
338
+ ...props,
339
+ children: [
340
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 12h8" }),
341
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 18V6" }),
342
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 18V6" }),
343
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2" }),
344
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2" })
345
+ ]
346
+ });
347
+ }
348
+ //#endregion
349
+ //#region src/ui/icons/italic.tsx
350
+ function ItalicIcon({ size, width, height, ...props }) {
351
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
352
+ xmlns: "http://www.w3.org/2000/svg",
353
+ width: size ?? width ?? 24,
354
+ height: size ?? height ?? 24,
355
+ viewBox: "0 0 24 24",
356
+ fill: "none",
357
+ stroke: "currentColor",
358
+ strokeWidth: 2,
359
+ strokeLinecap: "round",
360
+ strokeLinejoin: "round",
361
+ "aria-hidden": "true",
362
+ ...props,
363
+ children: [
364
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
365
+ x1: "19",
366
+ x2: "10",
367
+ y1: "4",
368
+ y2: "4"
369
+ }),
370
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
371
+ x1: "14",
372
+ x2: "5",
373
+ y1: "20",
374
+ y2: "20"
375
+ }),
376
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
377
+ x1: "15",
378
+ x2: "9",
379
+ y1: "4",
380
+ y2: "20"
381
+ })
382
+ ]
383
+ });
384
+ }
385
+ //#endregion
386
+ //#region src/ui/icons/link.tsx
387
+ function LinkIcon({ size, width, height, ...props }) {
388
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
389
+ xmlns: "http://www.w3.org/2000/svg",
390
+ width: size ?? width ?? 24,
391
+ height: size ?? height ?? 24,
392
+ viewBox: "0 0 24 24",
393
+ fill: "none",
394
+ stroke: "currentColor",
395
+ strokeWidth: 2,
396
+ strokeLinecap: "round",
397
+ strokeLinejoin: "round",
398
+ "aria-hidden": "true",
399
+ ...props,
400
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
401
+ });
402
+ }
403
+ //#endregion
404
+ //#region src/ui/icons/list.tsx
405
+ function ListIcon({ size, width, height, ...props }) {
406
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
407
+ xmlns: "http://www.w3.org/2000/svg",
408
+ width: size ?? width ?? 24,
409
+ height: size ?? height ?? 24,
410
+ viewBox: "0 0 24 24",
411
+ fill: "none",
412
+ stroke: "currentColor",
413
+ strokeWidth: 2,
414
+ strokeLinecap: "round",
415
+ strokeLinejoin: "round",
416
+ "aria-hidden": "true",
417
+ ...props,
418
+ children: [
419
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 5h.01" }),
420
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 12h.01" }),
421
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 19h.01" }),
422
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 5h13" }),
423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 12h13" }),
424
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 19h13" })
425
+ ]
426
+ });
427
+ }
428
+ //#endregion
429
+ //#region src/ui/icons/list-ordered.tsx
430
+ function ListOrderedIcon({ size, width, height, ...props }) {
431
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
432
+ xmlns: "http://www.w3.org/2000/svg",
433
+ width: size ?? width ?? 24,
434
+ height: size ?? height ?? 24,
435
+ viewBox: "0 0 24 24",
436
+ fill: "none",
437
+ stroke: "currentColor",
438
+ strokeWidth: 2,
439
+ strokeLinecap: "round",
440
+ strokeLinejoin: "round",
441
+ "aria-hidden": "true",
442
+ ...props,
443
+ children: [
444
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M11 5h10" }),
445
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M11 12h10" }),
446
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M11 19h10" }),
447
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 4h1v5" }),
448
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 9h2" }),
449
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02" })
450
+ ]
451
+ });
452
+ }
453
+ //#endregion
454
+ //#region src/ui/icons/mouse-pointer.tsx
455
+ function MousePointerIcon({ size, width, height, ...props }) {
456
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
457
+ xmlns: "http://www.w3.org/2000/svg",
458
+ width: size ?? width ?? 24,
459
+ height: size ?? height ?? 24,
460
+ viewBox: "0 0 24 24",
461
+ fill: "none",
462
+ stroke: "currentColor",
463
+ strokeWidth: 2,
464
+ strokeLinecap: "round",
465
+ strokeLinejoin: "round",
466
+ "aria-hidden": "true",
467
+ ...props,
468
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12.586 12.586 19 19" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z" })]
469
+ });
470
+ }
471
+ //#endregion
472
+ //#region src/ui/icons/pencil.tsx
473
+ function PencilIcon({ size, width, height, ...props }) {
474
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
475
+ xmlns: "http://www.w3.org/2000/svg",
476
+ width: size ?? width ?? 24,
477
+ height: size ?? height ?? 24,
478
+ viewBox: "0 0 24 24",
479
+ fill: "none",
480
+ stroke: "currentColor",
481
+ strokeWidth: 2,
482
+ strokeLinecap: "round",
483
+ strokeLinejoin: "round",
484
+ "aria-hidden": "true",
485
+ ...props,
486
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m15 5 4 4" })]
487
+ });
488
+ }
489
+ //#endregion
490
+ //#region src/ui/icons/rows-2.tsx
491
+ function Rows2Icon({ size, width, height, ...props }) {
492
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
493
+ xmlns: "http://www.w3.org/2000/svg",
494
+ width: size ?? width ?? 24,
495
+ height: size ?? height ?? 24,
496
+ viewBox: "0 0 24 24",
497
+ fill: "none",
498
+ stroke: "currentColor",
499
+ strokeWidth: 2,
500
+ strokeLinecap: "round",
501
+ strokeLinejoin: "round",
502
+ "aria-hidden": "true",
503
+ ...props,
504
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
505
+ width: "18",
506
+ height: "18",
507
+ x: "3",
508
+ y: "3",
509
+ rx: "2"
510
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 12h18" })]
511
+ });
512
+ }
513
+ //#endregion
514
+ //#region src/ui/icons/split-square-vertical.tsx
515
+ function SplitSquareVerticalIcon({ size, width, height, ...props }) {
516
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
517
+ xmlns: "http://www.w3.org/2000/svg",
518
+ width: size ?? width ?? 24,
519
+ height: size ?? height ?? 24,
520
+ viewBox: "0 0 24 24",
521
+ fill: "none",
522
+ stroke: "currentColor",
523
+ strokeWidth: 2,
524
+ strokeLinecap: "round",
525
+ strokeLinejoin: "round",
526
+ "aria-hidden": "true",
527
+ ...props,
528
+ children: [
529
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3" }),
530
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3" }),
531
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
532
+ x1: "4",
533
+ x2: "20",
534
+ y1: "12",
535
+ y2: "12"
536
+ })
537
+ ]
538
+ });
539
+ }
540
+ //#endregion
541
+ //#region src/ui/icons/square-code.tsx
542
+ function SquareCodeIcon({ size, width, height, ...props }) {
543
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
544
+ xmlns: "http://www.w3.org/2000/svg",
545
+ width: size ?? width ?? 24,
546
+ height: size ?? height ?? 24,
547
+ viewBox: "0 0 24 24",
548
+ fill: "none",
549
+ stroke: "currentColor",
550
+ strokeWidth: 2,
551
+ strokeLinecap: "round",
552
+ strokeLinejoin: "round",
553
+ "aria-hidden": "true",
554
+ ...props,
555
+ children: [
556
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m10 9-3 3 3 3" }),
557
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m14 15 3-3-3-3" }),
558
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
559
+ x: "3",
560
+ y: "3",
561
+ width: "18",
562
+ height: "18",
563
+ rx: "2"
564
+ })
565
+ ]
566
+ });
567
+ }
568
+ //#endregion
569
+ //#region src/ui/icons/strikethrough.tsx
570
+ function StrikethroughIcon({ size, width, height, ...props }) {
571
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
572
+ xmlns: "http://www.w3.org/2000/svg",
573
+ width: size ?? width ?? 24,
574
+ height: size ?? height ?? 24,
575
+ viewBox: "0 0 24 24",
576
+ fill: "none",
577
+ stroke: "currentColor",
578
+ strokeWidth: 2,
579
+ strokeLinecap: "round",
580
+ strokeLinejoin: "round",
581
+ "aria-hidden": "true",
582
+ ...props,
583
+ children: [
584
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
585
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
586
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
587
+ x1: "4",
588
+ x2: "20",
589
+ y1: "12",
590
+ y2: "12"
591
+ })
592
+ ]
593
+ });
594
+ }
595
+ //#endregion
596
+ //#region src/ui/icons/text.tsx
597
+ function TextIcon({ size, width, height, ...props }) {
598
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
599
+ xmlns: "http://www.w3.org/2000/svg",
600
+ width: size ?? width ?? 24,
601
+ height: size ?? height ?? 24,
602
+ viewBox: "0 0 24 24",
603
+ fill: "none",
604
+ stroke: "currentColor",
605
+ strokeWidth: 2,
606
+ strokeLinecap: "round",
607
+ strokeLinejoin: "round",
608
+ "aria-hidden": "true",
609
+ ...props,
610
+ children: [
611
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
612
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 12H3" }),
613
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 19H3" })
614
+ ]
615
+ });
616
+ }
617
+ //#endregion
618
+ //#region src/ui/icons/text-quote.tsx
619
+ function TextQuoteIcon({ size, width, height, ...props }) {
620
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
621
+ xmlns: "http://www.w3.org/2000/svg",
622
+ width: size ?? width ?? 24,
623
+ height: size ?? height ?? 24,
624
+ viewBox: "0 0 24 24",
625
+ fill: "none",
626
+ stroke: "currentColor",
627
+ strokeWidth: 2,
628
+ strokeLinecap: "round",
629
+ strokeLinejoin: "round",
630
+ "aria-hidden": "true",
631
+ ...props,
632
+ children: [
633
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 5H3" }),
634
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 12H8" }),
635
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 19H8" }),
636
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 12v7" })
637
+ ]
638
+ });
639
+ }
640
+ //#endregion
641
+ //#region src/ui/icons/underline.tsx
642
+ function UnderlineIcon({ size, width, height, ...props }) {
643
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
644
+ xmlns: "http://www.w3.org/2000/svg",
645
+ width: size ?? width ?? 24,
646
+ height: size ?? height ?? 24,
647
+ viewBox: "0 0 24 24",
648
+ fill: "none",
649
+ stroke: "currentColor",
650
+ strokeWidth: 2,
651
+ strokeLinecap: "round",
652
+ strokeLinejoin: "round",
653
+ "aria-hidden": "true",
654
+ ...props,
655
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
656
+ x1: "4",
657
+ x2: "20",
658
+ y1: "20",
659
+ y2: "20"
660
+ })]
661
+ });
662
+ }
663
+ //#endregion
664
+ //#region src/ui/icons/unlink.tsx
665
+ function UnlinkIcon({ size, width, height, ...props }) {
666
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
667
+ xmlns: "http://www.w3.org/2000/svg",
668
+ width: size ?? width ?? 24,
669
+ height: size ?? height ?? 24,
670
+ viewBox: "0 0 24 24",
671
+ fill: "none",
672
+ stroke: "currentColor",
673
+ strokeWidth: 2,
674
+ strokeLinecap: "round",
675
+ strokeLinejoin: "round",
676
+ "aria-hidden": "true",
677
+ ...props,
678
+ children: [
679
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" }),
680
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" }),
681
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
682
+ x1: "8",
683
+ x2: "8",
684
+ y1: "2",
685
+ y2: "5"
686
+ }),
687
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
688
+ x1: "2",
689
+ x2: "5",
690
+ y1: "8",
691
+ y2: "8"
692
+ }),
693
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
694
+ x1: "16",
695
+ x2: "16",
696
+ y1: "19",
697
+ y2: "22"
698
+ }),
699
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
700
+ x1: "19",
701
+ x2: "22",
702
+ y1: "16",
703
+ y2: "16"
704
+ })
705
+ ]
706
+ });
707
+ }
708
+ //#endregion
709
+ //#region src/ui/bubble-menu/context.tsx
710
+ const BubbleMenuContext = react.createContext(null);
711
+ function useBubbleMenuContext() {
712
+ const context = react.useContext(BubbleMenuContext);
713
+ if (!context) throw new Error("BubbleMenu compound components must be used within <BubbleMenu>");
714
+ return context;
715
+ }
716
+ //#endregion
717
+ //#region src/ui/bubble-menu/item.tsx
718
+ function BubbleMenuItem({ name, isActive, onCommand, className, children, ...rest }) {
719
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
720
+ type: "button",
721
+ "aria-label": name,
722
+ "aria-pressed": isActive,
723
+ className,
724
+ "data-re-bubble-menu-item": "",
725
+ "data-item": name,
726
+ ...isActive ? { "data-active": "" } : {},
727
+ onMouseDown: (e) => e.preventDefault(),
728
+ onClick: onCommand,
729
+ ...rest,
730
+ children
731
+ });
732
+ }
733
+ //#endregion
734
+ //#region src/ui/bubble-menu/align-center.tsx
735
+ function BubbleMenuAlignCenter({ className, children }) {
736
+ const { editor } = useBubbleMenuContext();
737
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
738
+ name: "align-center",
739
+ isActive: (0, _tiptap_react.useEditorState)({
740
+ editor,
741
+ selector: ({ editor }) => editor?.isActive({ alignment: "center" }) ?? false
742
+ }),
743
+ onCommand: () => require_set_text_alignment.setTextAlignment(editor, "center"),
744
+ className,
745
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignCenterIcon, {})
746
+ });
747
+ }
748
+ //#endregion
749
+ //#region src/ui/bubble-menu/align-left.tsx
750
+ function BubbleMenuAlignLeft({ className, children }) {
751
+ const { editor } = useBubbleMenuContext();
752
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
753
+ name: "align-left",
754
+ isActive: (0, _tiptap_react.useEditorState)({
755
+ editor,
756
+ selector: ({ editor }) => editor?.isActive({ alignment: "left" }) ?? false
757
+ }),
758
+ onCommand: () => require_set_text_alignment.setTextAlignment(editor, "left"),
759
+ className,
760
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignLeftIcon, {})
761
+ });
762
+ }
763
+ //#endregion
764
+ //#region src/ui/bubble-menu/align-right.tsx
765
+ function BubbleMenuAlignRight({ className, children }) {
766
+ const { editor } = useBubbleMenuContext();
767
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
768
+ name: "align-right",
769
+ isActive: (0, _tiptap_react.useEditorState)({
770
+ editor,
771
+ selector: ({ editor }) => editor?.isActive({ alignment: "right" }) ?? false
772
+ }),
773
+ onCommand: () => require_set_text_alignment.setTextAlignment(editor, "right"),
774
+ className,
775
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignRightIcon, {})
776
+ });
777
+ }
778
+ //#endregion
779
+ //#region src/ui/bubble-menu/create-mark-bubble-item.tsx
780
+ function createMarkBubbleItem(config) {
781
+ function MarkBubbleItem({ className, children }) {
782
+ const { editor } = useBubbleMenuContext();
783
+ const isActive = (0, _tiptap_react.useEditorState)({
784
+ editor,
785
+ selector: ({ editor }) => {
786
+ if (config.activeParams) return editor?.isActive(config.activeName, config.activeParams) ?? false;
787
+ return editor?.isActive(config.activeName) ?? false;
788
+ }
789
+ });
790
+ const handleCommand = () => {
791
+ const chain = editor.chain().focus();
792
+ const method = chain[config.command];
793
+ if (method) method.call(chain).run();
794
+ };
795
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
796
+ name: config.name,
797
+ isActive,
798
+ onCommand: handleCommand,
799
+ className,
800
+ children: children ?? config.icon
801
+ });
802
+ }
803
+ MarkBubbleItem.displayName = `BubbleMenu${config.name.charAt(0).toUpperCase() + config.name.slice(1)}`;
804
+ return MarkBubbleItem;
805
+ }
806
+ //#endregion
807
+ //#region src/ui/bubble-menu/bold.tsx
808
+ const BubbleMenuBold = createMarkBubbleItem({
809
+ name: "bold",
810
+ activeName: "bold",
811
+ command: "toggleBold",
812
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoldIcon, {})
813
+ });
814
+ //#endregion
815
+ //#region src/ui/bubble-menu/button-edit-link.tsx
816
+ function BubbleMenuButtonEditLink({ className, children, onClick, onMouseDown, ...rest }) {
817
+ const { setIsEditing } = useBubbleMenuContext();
818
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
819
+ ...rest,
820
+ type: "button",
821
+ "aria-label": "Edit link",
822
+ "data-re-btn-bm-item": "",
823
+ "data-item": "edit-link",
824
+ className,
825
+ onMouseDown: (e) => {
826
+ e.preventDefault();
827
+ onMouseDown?.(e);
828
+ },
829
+ onClick: (e) => {
830
+ onClick?.(e);
831
+ setIsEditing(true);
832
+ },
833
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PencilIcon, {})
834
+ });
835
+ }
836
+ //#endregion
837
+ //#region src/ui/bubble-menu/utils.ts
838
+ const SAFE_PROTOCOLS = new Set([
839
+ "http:",
840
+ "https:",
841
+ "mailto:",
842
+ "tel:"
843
+ ]);
844
+ /**
845
+ * Basic URL validation and auto-prefixing.
846
+ * Rejects dangerous schemes (javascript:, data:, vbscript:, etc.).
847
+ * Returns the valid URL string or null.
848
+ */
849
+ function getUrlFromString(str) {
850
+ if (str === "#") return str;
851
+ try {
852
+ const url = new URL(str);
853
+ if (SAFE_PROTOCOLS.has(url.protocol)) return str;
854
+ return null;
855
+ } catch {}
856
+ try {
857
+ if (str.includes(".") && !str.includes(" ")) return new URL(`https://${str}`).toString();
858
+ } catch {}
859
+ return null;
860
+ }
861
+ function setLinkHref(editor, href) {
862
+ if (href.length === 0) {
863
+ editor.chain().unsetLink().run();
864
+ return;
865
+ }
866
+ const { from, to } = editor.state.selection;
867
+ if (from === to) {
868
+ editor.chain().extendMarkRange("link").setLink({ href }).setTextSelection({
869
+ from,
870
+ to
871
+ }).run();
872
+ return;
873
+ }
874
+ editor.chain().setLink({ href }).run();
875
+ }
876
+ function focusEditor(editor) {
877
+ setTimeout(() => {
878
+ editor.commands.focus();
879
+ }, 0);
880
+ }
881
+ //#endregion
882
+ //#region src/ui/bubble-menu/button-form.tsx
883
+ function BubbleMenuButtonForm({ className, validateUrl, onLinkApply, onLinkRemove }) {
884
+ const { editor, isEditing, setIsEditing } = useBubbleMenuContext();
885
+ const inputRef = react.useRef(null);
886
+ const formRef = react.useRef(null);
887
+ const buttonHref = editor.getAttributes("button").href ?? "";
888
+ const displayHref = buttonHref === "#" ? "" : buttonHref;
889
+ const [inputValue, setInputValue] = react.useState(displayHref);
890
+ react.useEffect(() => {
891
+ if (!isEditing) return;
892
+ const currentHref = editor.getAttributes("button").href ?? "";
893
+ setInputValue(currentHref === "#" ? "" : currentHref);
894
+ const timeoutId = setTimeout(() => {
895
+ inputRef.current?.focus();
896
+ }, 0);
897
+ return () => clearTimeout(timeoutId);
898
+ }, [isEditing, editor]);
899
+ react.useEffect(() => {
900
+ if (!isEditing) return;
901
+ const handleKeyDown = (event) => {
902
+ if (event.key === "Escape") setIsEditing(false);
903
+ };
904
+ const handleClickOutside = (event) => {
905
+ if (formRef.current && !formRef.current.contains(event.target)) {
906
+ const form = formRef.current;
907
+ const submitEvent = new Event("submit", {
908
+ bubbles: true,
909
+ cancelable: true
910
+ });
911
+ form.dispatchEvent(submitEvent);
912
+ setIsEditing(false);
913
+ }
914
+ };
915
+ document.addEventListener("mousedown", handleClickOutside);
916
+ window.addEventListener("keydown", handleKeyDown);
917
+ return () => {
918
+ window.removeEventListener("keydown", handleKeyDown);
919
+ document.removeEventListener("mousedown", handleClickOutside);
920
+ };
921
+ }, [isEditing, setIsEditing]);
922
+ if (!isEditing) return null;
923
+ function handleSubmit(e) {
924
+ e.preventDefault();
925
+ const value = inputValue.trim();
926
+ if (value === "") {
927
+ editor.commands.updateButton({ href: "#" });
928
+ setIsEditing(false);
929
+ focusEditor(editor);
930
+ onLinkRemove?.();
931
+ return;
932
+ }
933
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
934
+ if (!finalValue) {
935
+ editor.commands.updateButton({ href: "#" });
936
+ setIsEditing(false);
937
+ focusEditor(editor);
938
+ onLinkRemove?.();
939
+ return;
940
+ }
941
+ editor.commands.updateButton({ href: finalValue });
942
+ setIsEditing(false);
943
+ focusEditor(editor);
944
+ onLinkApply?.(finalValue);
945
+ }
946
+ function handleUnlink(e) {
947
+ e.stopPropagation();
948
+ editor.commands.updateButton({ href: "#" });
949
+ setIsEditing(false);
950
+ focusEditor(editor);
951
+ onLinkRemove?.();
952
+ }
953
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
954
+ ref: formRef,
955
+ "data-re-btn-bm-form": "",
956
+ className,
957
+ onMouseDown: (e) => e.stopPropagation(),
958
+ onClick: (e) => e.stopPropagation(),
959
+ onKeyDown: (e) => e.stopPropagation(),
960
+ onSubmit: handleSubmit,
961
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
962
+ ref: inputRef,
963
+ "data-re-btn-bm-input": "",
964
+ value: inputValue,
965
+ onFocus: (e) => e.stopPropagation(),
966
+ onChange: (e) => setInputValue(e.target.value),
967
+ placeholder: "Paste a link",
968
+ type: "text"
969
+ }), displayHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
970
+ type: "button",
971
+ "aria-label": "Remove link",
972
+ "data-re-btn-bm-unlink": "",
973
+ onClick: handleUnlink,
974
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
975
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
976
+ type: "submit",
977
+ "aria-label": "Apply link",
978
+ "data-re-btn-bm-apply": "",
979
+ onMouseDown: (e) => e.stopPropagation(),
980
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {})
981
+ })]
982
+ });
983
+ }
984
+ //#endregion
985
+ //#region src/ui/bubble-menu/button-toolbar.tsx
986
+ function BubbleMenuButtonToolbar({ children, ...rest }) {
987
+ const { isEditing } = useBubbleMenuContext();
988
+ if (isEditing) return null;
989
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
990
+ "data-re-btn-bm-toolbar": "",
991
+ ...rest,
992
+ children
993
+ });
994
+ }
995
+ //#endregion
996
+ //#region src/ui/bubble-menu/button-unlink.tsx
997
+ function BubbleMenuButtonUnlink({ className, children, onClick, onMouseDown, onLinkRemove, ...rest }) {
998
+ const { editor } = useBubbleMenuContext();
999
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1000
+ ...rest,
1001
+ type: "button",
1002
+ "aria-label": "Remove link",
1003
+ "data-re-btn-bm-item": "",
1004
+ "data-item": "unlink",
1005
+ className,
1006
+ onMouseDown: (e) => {
1007
+ e.preventDefault();
1008
+ onMouseDown?.(e);
1009
+ },
1010
+ onClick: (e) => {
1011
+ onClick?.(e);
1012
+ editor.commands.updateButton({ href: "#" });
1013
+ focusEditor(editor);
1014
+ onLinkRemove?.();
1015
+ },
1016
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1017
+ });
1018
+ }
1019
+ //#endregion
1020
+ //#region src/ui/bubble-menu/code.tsx
1021
+ const BubbleMenuCode = createMarkBubbleItem({
1022
+ name: "code",
1023
+ activeName: "code",
1024
+ command: "toggleCode",
1025
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeIcon, {})
1026
+ });
1027
+ //#endregion
1028
+ //#region src/ui/bubble-menu/group.tsx
1029
+ function BubbleMenuItemGroup({ className, children }) {
1030
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("fieldset", {
1031
+ className,
1032
+ "data-re-bubble-menu-group": "",
1033
+ children
1034
+ });
1035
+ }
1036
+ //#endregion
1037
+ //#region src/ui/bubble-menu/italic.tsx
1038
+ const BubbleMenuItalic = createMarkBubbleItem({
1039
+ name: "italic",
1040
+ activeName: "italic",
1041
+ command: "toggleItalic",
1042
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItalicIcon, {})
1043
+ });
1044
+ //#endregion
1045
+ //#region src/ui/bubble-menu/link-selector.tsx
1046
+ function BubbleMenuLinkSelector({ className, showToggle = true, validateUrl, onLinkApply, onLinkRemove, children, open: controlledOpen, onOpenChange }) {
1047
+ const { editor } = useBubbleMenuContext();
1048
+ const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
1049
+ const isControlled = controlledOpen !== void 0;
1050
+ const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
1051
+ const setIsOpen = react.useCallback((value) => {
1052
+ if (!isControlled) setUncontrolledOpen(value);
1053
+ onOpenChange?.(value);
1054
+ }, [isControlled, onOpenChange]);
1055
+ const editorState = (0, _tiptap_react.useEditorState)({
1056
+ editor,
1057
+ selector: ({ editor }) => ({
1058
+ isLinkActive: editor?.isActive("link") ?? false,
1059
+ hasLink: Boolean(editor?.getAttributes("link").href),
1060
+ currentHref: editor?.getAttributes("link").href || ""
1061
+ })
1062
+ });
1063
+ const setIsOpenRef = react.useRef(setIsOpen);
1064
+ setIsOpenRef.current = setIsOpen;
1065
+ react.useEffect(() => {
1066
+ const subscription = require_event_bus.editorEventBus.on("bubble-menu:add-link", () => {
1067
+ setIsOpenRef.current(true);
1068
+ });
1069
+ return () => {
1070
+ setIsOpenRef.current(false);
1071
+ subscription.unsubscribe();
1072
+ };
1073
+ }, []);
1074
+ if (!editorState) return null;
1075
+ const handleOpenLink = () => {
1076
+ setIsOpen(!isOpen);
1077
+ };
1078
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1079
+ "data-re-link-selector": "",
1080
+ ...isOpen ? { "data-open": "" } : {},
1081
+ ...editorState.hasLink ? { "data-has-link": "" } : {},
1082
+ className,
1083
+ children: [showToggle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1084
+ type: "button",
1085
+ "aria-expanded": isOpen,
1086
+ "aria-haspopup": "true",
1087
+ "aria-label": "Add link",
1088
+ "aria-pressed": editorState.isLinkActive && editorState.hasLink,
1089
+ "data-re-link-selector-trigger": "",
1090
+ onClick: handleOpenLink,
1091
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkIcon, {})
1092
+ }), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkForm, {
1093
+ editor,
1094
+ currentHref: editorState.currentHref,
1095
+ validateUrl,
1096
+ onLinkApply,
1097
+ onLinkRemove,
1098
+ setIsOpen,
1099
+ children
1100
+ })]
1101
+ });
1102
+ }
1103
+ function LinkForm({ editor, currentHref, validateUrl, onLinkApply, onLinkRemove, setIsOpen, children }) {
1104
+ const inputRef = react.useRef(null);
1105
+ const formRef = react.useRef(null);
1106
+ const displayHref = currentHref === "#" ? "" : currentHref;
1107
+ const [inputValue, setInputValue] = react.useState(displayHref);
1108
+ react.useEffect(() => {
1109
+ const timeoutId = setTimeout(() => {
1110
+ inputRef.current?.focus();
1111
+ }, 0);
1112
+ return () => clearTimeout(timeoutId);
1113
+ }, []);
1114
+ react.useEffect(() => {
1115
+ const handleKeyDown = (event) => {
1116
+ if (event.key === "Escape") {
1117
+ if (editor.getAttributes("link").href === "#") editor.chain().unsetLink().run();
1118
+ setIsOpen(false);
1119
+ }
1120
+ };
1121
+ const handleClickOutside = (event) => {
1122
+ if (formRef.current && !formRef.current.contains(event.target)) {
1123
+ const form = formRef.current;
1124
+ const submitEvent = new Event("submit", {
1125
+ bubbles: true,
1126
+ cancelable: true
1127
+ });
1128
+ form.dispatchEvent(submitEvent);
1129
+ setIsOpen(false);
1130
+ }
1131
+ };
1132
+ document.addEventListener("mousedown", handleClickOutside);
1133
+ window.addEventListener("keydown", handleKeyDown);
1134
+ return () => {
1135
+ window.removeEventListener("keydown", handleKeyDown);
1136
+ document.removeEventListener("mousedown", handleClickOutside);
1137
+ };
1138
+ }, [editor, setIsOpen]);
1139
+ function handleSubmit(e) {
1140
+ e.preventDefault();
1141
+ const value = inputValue.trim();
1142
+ if (value === "") {
1143
+ setLinkHref(editor, "");
1144
+ setIsOpen(false);
1145
+ focusEditor(editor);
1146
+ onLinkRemove?.();
1147
+ return;
1148
+ }
1149
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1150
+ if (!finalValue) {
1151
+ setLinkHref(editor, "");
1152
+ setIsOpen(false);
1153
+ focusEditor(editor);
1154
+ onLinkRemove?.();
1155
+ return;
1156
+ }
1157
+ setLinkHref(editor, finalValue);
1158
+ setIsOpen(false);
1159
+ focusEditor(editor);
1160
+ onLinkApply?.(finalValue);
1161
+ }
1162
+ function handleUnlink(e) {
1163
+ e.stopPropagation();
1164
+ setLinkHref(editor, "");
1165
+ setIsOpen(false);
1166
+ focusEditor(editor);
1167
+ onLinkRemove?.();
1168
+ }
1169
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1170
+ ref: formRef,
1171
+ "data-re-link-selector-form": "",
1172
+ onMouseDown: (e) => e.stopPropagation(),
1173
+ onClick: (e) => e.stopPropagation(),
1174
+ onKeyDown: (e) => e.stopPropagation(),
1175
+ onSubmit: handleSubmit,
1176
+ children: [
1177
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1178
+ ref: inputRef,
1179
+ "data-re-link-selector-input": "",
1180
+ value: inputValue,
1181
+ onFocus: (e) => e.stopPropagation(),
1182
+ onChange: (e) => setInputValue(e.target.value),
1183
+ placeholder: "Paste a link",
1184
+ type: "text"
1185
+ }),
1186
+ children,
1187
+ displayHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1188
+ type: "button",
1189
+ "aria-label": "Remove link",
1190
+ "data-re-link-selector-unlink": "",
1191
+ onClick: handleUnlink,
1192
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1193
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1194
+ type: "submit",
1195
+ "aria-label": "Apply link",
1196
+ "data-re-link-selector-apply": "",
1197
+ onMouseDown: (e) => e.stopPropagation(),
1198
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {})
1199
+ })
1200
+ ]
1201
+ });
1202
+ }
1203
+ //#endregion
1204
+ //#region src/ui/bubble-menu/node-selector.tsx
1205
+ const NodeSelectorContext = react.createContext(null);
1206
+ function useNodeSelectorContext() {
1207
+ const context = react.useContext(NodeSelectorContext);
1208
+ if (!context) throw new Error("NodeSelector compound components must be used within <NodeSelector.Root>");
1209
+ return context;
1210
+ }
1211
+ function NodeSelectorRoot({ omit = [], open: controlledOpen, onOpenChange, className, children }) {
1212
+ const { editor } = useBubbleMenuContext();
1213
+ const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
1214
+ const isControlled = controlledOpen !== void 0;
1215
+ const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
1216
+ const setIsOpen = react.useCallback((value) => {
1217
+ if (!isControlled) setUncontrolledOpen(value);
1218
+ onOpenChange?.(value);
1219
+ }, [isControlled, onOpenChange]);
1220
+ const editorState = (0, _tiptap_react.useEditorState)({
1221
+ editor,
1222
+ selector: ({ editor }) => ({
1223
+ isParagraphActive: (editor?.isActive("paragraph") ?? false) && !editor?.isActive("bulletList") && !editor?.isActive("orderedList"),
1224
+ isHeading1Active: editor?.isActive("heading", { level: 1 }) ?? false,
1225
+ isHeading2Active: editor?.isActive("heading", { level: 2 }) ?? false,
1226
+ isHeading3Active: editor?.isActive("heading", { level: 3 }) ?? false,
1227
+ isBulletListActive: editor?.isActive("bulletList") ?? false,
1228
+ isOrderedListActive: editor?.isActive("orderedList") ?? false,
1229
+ isBlockquoteActive: editor?.isActive("blockquote") ?? false,
1230
+ isCodeBlockActive: editor?.isActive("codeBlock") ?? false
1231
+ })
1232
+ });
1233
+ const allItems = react.useMemo(() => [
1234
+ {
1235
+ name: "Text",
1236
+ icon: TextIcon,
1237
+ command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").run(),
1238
+ isActive: editorState?.isParagraphActive ?? false
1239
+ },
1240
+ {
1241
+ name: "Title",
1242
+ icon: Heading1Icon,
1243
+ command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
1244
+ isActive: editorState?.isHeading1Active ?? false
1245
+ },
1246
+ {
1247
+ name: "Subtitle",
1248
+ icon: Heading2Icon,
1249
+ command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
1250
+ isActive: editorState?.isHeading2Active ?? false
1251
+ },
1252
+ {
1253
+ name: "Heading",
1254
+ icon: Heading3Icon,
1255
+ command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
1256
+ isActive: editorState?.isHeading3Active ?? false
1257
+ },
1258
+ {
1259
+ name: "Bullet List",
1260
+ icon: ListIcon,
1261
+ command: () => editor.chain().focus().clearNodes().toggleBulletList().run(),
1262
+ isActive: editorState?.isBulletListActive ?? false
1263
+ },
1264
+ {
1265
+ name: "Numbered List",
1266
+ icon: ListOrderedIcon,
1267
+ command: () => editor.chain().focus().clearNodes().toggleOrderedList().run(),
1268
+ isActive: editorState?.isOrderedListActive ?? false
1269
+ },
1270
+ {
1271
+ name: "Quote",
1272
+ icon: TextQuoteIcon,
1273
+ command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").toggleBlockquote().run(),
1274
+ isActive: editorState?.isBlockquoteActive ?? false
1275
+ },
1276
+ {
1277
+ name: "Code",
1278
+ icon: CodeIcon,
1279
+ command: () => editor.chain().focus().clearNodes().toggleCodeBlock().run(),
1280
+ isActive: editorState?.isCodeBlockActive ?? false
1281
+ }
1282
+ ], [editor, editorState]);
1283
+ const items = react.useMemo(() => allItems.filter((item) => !omit.includes(item.name)), [allItems, omit]);
1284
+ const activeItem = react.useMemo(() => items.find((item) => item.isActive) ?? { name: "Multiple" }, [items]);
1285
+ const contextValue = react.useMemo(() => ({
1286
+ items,
1287
+ activeItem,
1288
+ isOpen,
1289
+ setIsOpen
1290
+ }), [
1291
+ items,
1292
+ activeItem,
1293
+ isOpen,
1294
+ setIsOpen
1295
+ ]);
1296
+ if (!editorState || items.length === 0) return null;
1297
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeSelectorContext.Provider, {
1298
+ value: contextValue,
1299
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Root, {
1300
+ open: isOpen,
1301
+ onOpenChange: setIsOpen,
1302
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1303
+ "data-re-node-selector": "",
1304
+ ...isOpen ? { "data-open": "" } : {},
1305
+ className,
1306
+ children
1307
+ })
1308
+ })
1309
+ });
1310
+ }
1311
+ function NodeSelectorTrigger({ className, children }) {
1312
+ const { activeItem, isOpen, setIsOpen } = useNodeSelectorContext();
1313
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Trigger, {
1314
+ "data-re-node-selector-trigger": "",
1315
+ className,
1316
+ onClick: () => setIsOpen(!isOpen),
1317
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: activeItem.name }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, {})] })
1318
+ });
1319
+ }
1320
+ function NodeSelectorContent({ className, align = "start", children }) {
1321
+ const { items, setIsOpen } = useNodeSelectorContext();
1322
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Content, {
1323
+ align,
1324
+ "data-re-node-selector-content": "",
1325
+ className,
1326
+ children: children ? children(items, () => setIsOpen(false)) : items.map((item) => {
1327
+ const Icon = item.icon;
1328
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1329
+ type: "button",
1330
+ "data-re-node-selector-item": "",
1331
+ ...item.isActive ? { "data-active": "" } : {},
1332
+ onClick: () => {
1333
+ item.command();
1334
+ setIsOpen(false);
1335
+ },
1336
+ children: [
1337
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {}),
1338
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.name }),
1339
+ item.isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {})
1340
+ ]
1341
+ }, item.name);
1342
+ })
1343
+ });
1344
+ }
1345
+ function BubbleMenuNodeSelector({ omit = [], className, triggerContent, open, onOpenChange }) {
1346
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NodeSelectorRoot, {
1347
+ omit,
1348
+ open,
1349
+ onOpenChange,
1350
+ className,
1351
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeSelectorTrigger, { children: triggerContent }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeSelectorContent, {})]
1352
+ });
1353
+ }
1354
+ //#endregion
1355
+ //#region src/ui/bubble-menu/strike.tsx
1356
+ const BubbleMenuStrike = createMarkBubbleItem({
1357
+ name: "strike",
1358
+ activeName: "strike",
1359
+ command: "toggleStrike",
1360
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StrikethroughIcon, {})
1361
+ });
1362
+ //#endregion
1363
+ //#region src/ui/bubble-menu/triggers.ts
1364
+ const bubbleMenuTriggers = {
1365
+ textSelection(hideWhenActiveNodes = [], hideWhenActiveMarks = []) {
1366
+ return ({ editor, state }) => {
1367
+ for (const node of hideWhenActiveNodes) {
1368
+ if (editor.isActive(node)) return false;
1369
+ const { $from } = state.selection;
1370
+ for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === node) return false;
1371
+ }
1372
+ for (const mark of hideWhenActiveMarks) if (editor.isActive(mark)) return false;
1373
+ return editor.view.state.selection.content().size > 0;
1374
+ };
1375
+ },
1376
+ node(name) {
1377
+ return ({ editor }) => editor.isActive(name);
1378
+ },
1379
+ nodeWithoutSelection(name) {
1380
+ return ({ editor }) => editor.isActive(name) && editor.view.state.selection.content().size === 0;
1381
+ }
1382
+ };
1383
+ //#endregion
1384
+ //#region src/ui/bubble-menu/underline.tsx
1385
+ const BubbleMenuUnderline = createMarkBubbleItem({
1386
+ name: "underline",
1387
+ activeName: "underline",
1388
+ command: "toggleUnderline",
1389
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnderlineIcon, {})
1390
+ });
1391
+ //#endregion
1392
+ //#region src/ui/bubble-menu/uppercase.tsx
1393
+ const BubbleMenuUppercase = createMarkBubbleItem({
1394
+ name: "uppercase",
1395
+ activeName: "uppercase",
1396
+ command: "toggleUppercase",
1397
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaseUpperIcon, {})
1398
+ });
1399
+ //#endregion
1400
+ //#region src/ui/bubble-menu/root.tsx
1401
+ const defaultPluginKey = new _tiptap_pm_state.PluginKey("bubbleMenu");
1402
+ function Root({ trigger, pluginKey = defaultPluginKey, hideWhenActiveNodes = [], hideWhenActiveMarks = [], placement = "bottom", offset = 8, onHide, className, children, ...rest }) {
1403
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
1404
+ const [isEditing, setIsEditing] = react.useState(false);
1405
+ const resolvedTrigger = trigger ?? bubbleMenuTriggers.textSelection(hideWhenActiveNodes, hideWhenActiveMarks);
1406
+ if (!editor) return null;
1407
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
1408
+ editor,
1409
+ pluginKey,
1410
+ "data-re-bubble-menu": "",
1411
+ shouldShow: resolvedTrigger,
1412
+ options: {
1413
+ placement,
1414
+ offset,
1415
+ onHide: () => {
1416
+ setIsEditing(false);
1417
+ onHide?.();
1418
+ }
1419
+ },
1420
+ className,
1421
+ ...rest,
1422
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuContext.Provider, {
1423
+ value: {
1424
+ editor,
1425
+ isEditing,
1426
+ setIsEditing
1427
+ },
1428
+ children
1429
+ })
1430
+ });
1431
+ }
1432
+ const textPluginKey = new _tiptap_pm_state.PluginKey("textBubbleMenu");
1433
+ function Default({ hideWhenActiveNodes, hideWhenActiveMarks, placement, offset, onHide, className, ...rest }) {
1434
+ const [isNodeSelectorOpen, setIsNodeSelectorOpen] = react.useState(false);
1435
+ const [isLinkSelectorOpen, setIsLinkSelectorOpen] = react.useState(false);
1436
+ const handleNodeSelectorOpenChange = react.useCallback((open) => {
1437
+ setIsNodeSelectorOpen(open);
1438
+ if (open) setIsLinkSelectorOpen(false);
1439
+ }, []);
1440
+ const handleLinkSelectorOpenChange = react.useCallback((open) => {
1441
+ setIsLinkSelectorOpen(open);
1442
+ if (open) setIsNodeSelectorOpen(false);
1443
+ }, []);
1444
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, {
1445
+ pluginKey: textPluginKey,
1446
+ hideWhenActiveNodes,
1447
+ hideWhenActiveMarks,
1448
+ placement,
1449
+ offset,
1450
+ onHide: react.useCallback(() => {
1451
+ setIsNodeSelectorOpen(false);
1452
+ setIsLinkSelectorOpen(false);
1453
+ onHide?.();
1454
+ }, [onHide]),
1455
+ className,
1456
+ ...rest,
1457
+ children: [
1458
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuNodeSelector, {
1459
+ open: isNodeSelectorOpen,
1460
+ onOpenChange: handleNodeSelectorOpenChange
1461
+ }),
1462
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkSelector, {
1463
+ open: isLinkSelectorOpen,
1464
+ onOpenChange: handleLinkSelectorOpenChange
1465
+ }),
1466
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuItemGroup, { children: [
1467
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuBold, {}),
1468
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItalic, {}),
1469
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuUnderline, {}),
1470
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuStrike, {}),
1471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuCode, {}),
1472
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuUppercase, {})
1473
+ ] }),
1474
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuItemGroup, { children: [
1475
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignLeft, {}),
1476
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignCenter, {}),
1477
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignRight, {})
1478
+ ] })
1479
+ ]
1480
+ });
1481
+ }
1482
+ function RootWithDefault({ children, ...rest }) {
1483
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root, {
1484
+ ...rest,
1485
+ children
1486
+ });
1487
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Default, { ...rest });
1488
+ }
1489
+ //#endregion
1490
+ //#region src/ui/bubble-menu/button-default.tsx
1491
+ const buttonPluginKey = new _tiptap_pm_state.PluginKey("buttonBubbleMenu");
1492
+ function BubbleMenuButtonDefaultInner({ validateUrl, onLinkApply, onLinkRemove }) {
1493
+ const { editor } = useBubbleMenuContext();
1494
+ const buttonHref = (0, _tiptap_react.useEditorState)({
1495
+ editor,
1496
+ selector: ({ editor: e }) => e?.getAttributes("button").href ?? ""
1497
+ });
1498
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuButtonToolbar, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonEditLink, {}), (buttonHref ?? "") !== "" && buttonHref !== "#" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonUnlink, { onLinkRemove })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonForm, {
1499
+ validateUrl,
1500
+ onLinkApply,
1501
+ onLinkRemove
1502
+ })] });
1503
+ }
1504
+ function BubbleMenuButtonDefault({ placement = "top", offset, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
1505
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootWithDefault, {
1506
+ trigger: bubbleMenuTriggers.node("button"),
1507
+ pluginKey: buttonPluginKey,
1508
+ placement,
1509
+ offset,
1510
+ onHide,
1511
+ className,
1512
+ ...rest,
1513
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonDefaultInner, {
1514
+ validateUrl,
1515
+ onLinkApply,
1516
+ onLinkRemove
1517
+ })
1518
+ });
1519
+ }
1520
+ //#endregion
1521
+ //#region src/ui/bubble-menu/image-edit-link.tsx
1522
+ function BubbleMenuImageEditLink({ className, children, onClick, onMouseDown, ...rest }) {
1523
+ const { setIsEditing } = useBubbleMenuContext();
1524
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1525
+ ...rest,
1526
+ type: "button",
1527
+ "aria-label": "Edit link",
1528
+ "data-re-img-bm-item": "",
1529
+ "data-item": "edit-link",
1530
+ className,
1531
+ onMouseDown: (e) => {
1532
+ e.preventDefault();
1533
+ onMouseDown?.(e);
1534
+ },
1535
+ onClick: (e) => {
1536
+ onClick?.(e);
1537
+ setIsEditing(true);
1538
+ },
1539
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkIcon, {})
1540
+ });
1541
+ }
1542
+ //#endregion
1543
+ //#region src/ui/bubble-menu/image-toolbar.tsx
1544
+ function BubbleMenuImageToolbar({ children, ...rest }) {
1545
+ const { isEditing } = useBubbleMenuContext();
1546
+ if (isEditing) return null;
1547
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1548
+ "data-re-img-bm-toolbar": "",
1549
+ ...rest,
1550
+ children
1551
+ });
1552
+ }
1553
+ //#endregion
1554
+ //#region src/ui/bubble-menu/image-default.tsx
1555
+ const imagePluginKey = new _tiptap_pm_state.PluginKey("imageBubbleMenu");
1556
+ function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset, onHide, className, ...rest }) {
1557
+ const hasEditLink = !excludeItems.includes("edit-link");
1558
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootWithDefault, {
1559
+ trigger: bubbleMenuTriggers.node("image"),
1560
+ pluginKey: imagePluginKey,
1561
+ placement,
1562
+ offset,
1563
+ onHide,
1564
+ className,
1565
+ ...rest,
1566
+ children: hasEditLink && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageToolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageEditLink, {}) })
1567
+ });
1568
+ }
1569
+ //#endregion
1570
+ //#region src/ui/bubble-menu/link-edit-link.tsx
1571
+ function BubbleMenuLinkEditLink({ className, children, onClick, onMouseDown, ...rest }) {
1572
+ const { setIsEditing } = useBubbleMenuContext();
1573
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1574
+ type: "button",
1575
+ "aria-label": "Edit link",
1576
+ "data-re-link-bm-item": "",
1577
+ "data-item": "edit-link",
1578
+ className,
1579
+ onMouseDown: (e) => {
1580
+ e.preventDefault();
1581
+ onMouseDown?.(e);
1582
+ },
1583
+ onClick: (e) => {
1584
+ onClick?.(e);
1585
+ setIsEditing(true);
1586
+ },
1587
+ ...rest,
1588
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PencilIcon, {})
1589
+ });
1590
+ }
1591
+ //#endregion
1592
+ //#region src/ui/bubble-menu/link-form.tsx
1593
+ function BubbleMenuLinkForm({ className, validateUrl, onLinkApply, onLinkRemove, children }) {
1594
+ const { editor, isEditing, setIsEditing } = useBubbleMenuContext();
1595
+ const inputRef = react.useRef(null);
1596
+ const formRef = react.useRef(null);
1597
+ const linkHref = (0, _tiptap_react.useEditorState)({
1598
+ editor,
1599
+ selector: ({ editor: e }) => e?.getAttributes("link").href ?? ""
1600
+ });
1601
+ const displayHref = (linkHref ?? "") === "#" ? "" : linkHref ?? "";
1602
+ const [inputValue, setInputValue] = react.useState(displayHref);
1603
+ react.useEffect(() => {
1604
+ if (!isEditing) return;
1605
+ setInputValue(displayHref);
1606
+ const timeoutId = setTimeout(() => {
1607
+ inputRef.current?.focus();
1608
+ }, 0);
1609
+ return () => clearTimeout(timeoutId);
1610
+ }, [isEditing, displayHref]);
1611
+ react.useEffect(() => {
1612
+ if (!isEditing) return;
1613
+ const handleKeyDown = (event) => {
1614
+ if (event.key === "Escape") setIsEditing(false);
1615
+ };
1616
+ const handleClickOutside = (event) => {
1617
+ if (formRef.current && !formRef.current.contains(event.target)) {
1618
+ const form = formRef.current;
1619
+ const submitEvent = new Event("submit", {
1620
+ bubbles: true,
1621
+ cancelable: true
1622
+ });
1623
+ form.dispatchEvent(submitEvent);
1624
+ setIsEditing(false);
1625
+ }
1626
+ };
1627
+ document.addEventListener("mousedown", handleClickOutside);
1628
+ window.addEventListener("keydown", handleKeyDown);
1629
+ return () => {
1630
+ window.removeEventListener("keydown", handleKeyDown);
1631
+ document.removeEventListener("mousedown", handleClickOutside);
1632
+ };
1633
+ }, [isEditing, setIsEditing]);
1634
+ if (!isEditing) return null;
1635
+ function handleSubmit(e) {
1636
+ e.preventDefault();
1637
+ const value = inputValue.trim();
1638
+ if (value === "") {
1639
+ setLinkHref(editor, "");
1640
+ setIsEditing(false);
1641
+ focusEditor(editor);
1642
+ onLinkRemove?.();
1643
+ return;
1644
+ }
1645
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1646
+ if (!finalValue) {
1647
+ setLinkHref(editor, "");
1648
+ setIsEditing(false);
1649
+ focusEditor(editor);
1650
+ onLinkRemove?.();
1651
+ return;
1652
+ }
1653
+ setLinkHref(editor, finalValue);
1654
+ setIsEditing(false);
1655
+ focusEditor(editor);
1656
+ onLinkApply?.(finalValue);
1657
+ }
1658
+ function handleUnlink(e) {
1659
+ e.stopPropagation();
1660
+ setLinkHref(editor, "");
1661
+ setIsEditing(false);
1662
+ focusEditor(editor);
1663
+ onLinkRemove?.();
1664
+ }
1665
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1666
+ ref: formRef,
1667
+ "data-re-link-bm-form": "",
1668
+ className,
1669
+ onMouseDown: (e) => e.stopPropagation(),
1670
+ onClick: (e) => e.stopPropagation(),
1671
+ onKeyDown: (e) => e.stopPropagation(),
1672
+ onSubmit: handleSubmit,
1673
+ children: [
1674
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1675
+ ref: inputRef,
1676
+ "data-re-link-bm-input": "",
1677
+ value: inputValue,
1678
+ onFocus: (e) => e.stopPropagation(),
1679
+ onChange: (e) => setInputValue(e.target.value),
1680
+ placeholder: "Paste a link",
1681
+ type: "text"
1682
+ }),
1683
+ children,
1684
+ displayHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1685
+ type: "button",
1686
+ "aria-label": "Remove link",
1687
+ "data-re-link-bm-unlink": "",
1688
+ onClick: handleUnlink,
1689
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1690
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1691
+ type: "submit",
1692
+ "aria-label": "Apply link",
1693
+ "data-re-link-bm-apply": "",
1694
+ onMouseDown: (e) => e.stopPropagation(),
1695
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {})
1696
+ })
1697
+ ]
1698
+ });
1699
+ }
1700
+ //#endregion
1701
+ //#region src/ui/bubble-menu/link-open-link.tsx
1702
+ function BubbleMenuLinkOpenLink({ className, children, ...rest }) {
1703
+ const { editor } = useBubbleMenuContext();
1704
+ const linkHref = (0, _tiptap_react.useEditorState)({
1705
+ editor,
1706
+ selector: ({ editor: e }) => e?.getAttributes("link").href ?? ""
1707
+ });
1708
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1709
+ ...rest,
1710
+ href: linkHref ?? "",
1711
+ target: "_blank",
1712
+ rel: "noopener noreferrer",
1713
+ "aria-label": "Open link",
1714
+ "data-re-link-bm-item": "",
1715
+ "data-item": "open-link",
1716
+ className,
1717
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExternalLinkIcon, {})
1718
+ });
1719
+ }
1720
+ //#endregion
1721
+ //#region src/ui/bubble-menu/link-toolbar.tsx
1722
+ function BubbleMenuLinkToolbar({ children, ...rest }) {
1723
+ const { isEditing } = useBubbleMenuContext();
1724
+ if (isEditing) return null;
1725
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1726
+ "data-re-link-bm-toolbar": "",
1727
+ ...rest,
1728
+ children
1729
+ });
1730
+ }
1731
+ //#endregion
1732
+ //#region src/ui/bubble-menu/link-unlink.tsx
1733
+ function BubbleMenuLinkUnlink({ className, children, onClick, onMouseDown, ...rest }) {
1734
+ const { editor } = useBubbleMenuContext();
1735
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1736
+ type: "button",
1737
+ "aria-label": "Remove link",
1738
+ "data-re-link-bm-item": "",
1739
+ "data-item": "unlink",
1740
+ className,
1741
+ onMouseDown: (e) => {
1742
+ e.preventDefault();
1743
+ onMouseDown?.(e);
1744
+ },
1745
+ onClick: (e) => {
1746
+ onClick?.(e);
1747
+ editor.chain().focus().unsetLink().run();
1748
+ },
1749
+ ...rest,
1750
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1751
+ });
1752
+ }
1753
+ //#endregion
1754
+ //#region src/ui/bubble-menu/link-default.tsx
1755
+ const linkPluginKey = new _tiptap_pm_state.PluginKey("linkBubbleMenu");
1756
+ function BubbleMenuLinkDefault({ excludeItems = [], placement = "top", offset, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
1757
+ const has = (item) => !excludeItems.includes(item);
1758
+ const hasToolbarItems = has("edit-link") || has("open-link") || has("unlink");
1759
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RootWithDefault, {
1760
+ trigger: bubbleMenuTriggers.nodeWithoutSelection("link"),
1761
+ pluginKey: linkPluginKey,
1762
+ placement,
1763
+ offset,
1764
+ onHide,
1765
+ className,
1766
+ ...rest,
1767
+ children: [hasToolbarItems && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuLinkToolbar, { children: [
1768
+ has("edit-link") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkEditLink, {}),
1769
+ has("open-link") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkOpenLink, {}),
1770
+ has("unlink") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkUnlink, {})
1771
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkForm, {
1772
+ validateUrl,
1773
+ onLinkApply,
1774
+ onLinkRemove
1775
+ })]
1776
+ });
1777
+ }
1778
+ //#endregion
1779
+ //#region src/ui/bubble-menu/separator.tsx
1780
+ function BubbleMenuSeparator({ className }) {
1781
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {
1782
+ className,
1783
+ "data-re-bubble-menu-separator": ""
1784
+ });
1785
+ }
1786
+ //#endregion
1787
+ //#region src/ui/bubble-menu/index.ts
1788
+ const BubbleMenu = Object.assign(RootWithDefault, {
1789
+ Root: RootWithDefault,
1790
+ ItemGroup: BubbleMenuItemGroup,
1791
+ Separator: BubbleMenuSeparator,
1792
+ Item: BubbleMenuItem,
1793
+ Bold: BubbleMenuBold,
1794
+ Italic: BubbleMenuItalic,
1795
+ Underline: BubbleMenuUnderline,
1796
+ Strike: BubbleMenuStrike,
1797
+ Code: BubbleMenuCode,
1798
+ Uppercase: BubbleMenuUppercase,
1799
+ AlignLeft: BubbleMenuAlignLeft,
1800
+ AlignCenter: BubbleMenuAlignCenter,
1801
+ AlignRight: BubbleMenuAlignRight,
1802
+ NodeSelector: Object.assign(BubbleMenuNodeSelector, {
1803
+ Root: NodeSelectorRoot,
1804
+ Trigger: NodeSelectorTrigger,
1805
+ Content: NodeSelectorContent
1806
+ }),
1807
+ LinkSelector: BubbleMenuLinkSelector,
1808
+ ButtonToolbar: BubbleMenuButtonToolbar,
1809
+ ButtonEditLink: BubbleMenuButtonEditLink,
1810
+ ButtonUnlink: BubbleMenuButtonUnlink,
1811
+ ButtonForm: BubbleMenuButtonForm,
1812
+ ButtonDefault: BubbleMenuButtonDefault,
1813
+ LinkToolbar: BubbleMenuLinkToolbar,
1814
+ LinkEditLink: BubbleMenuLinkEditLink,
1815
+ LinkUnlink: BubbleMenuLinkUnlink,
1816
+ LinkOpenLink: BubbleMenuLinkOpenLink,
1817
+ LinkForm: BubbleMenuLinkForm,
1818
+ LinkDefault: BubbleMenuLinkDefault,
1819
+ ImageToolbar: BubbleMenuImageToolbar,
1820
+ ImageEditLink: BubbleMenuImageEditLink,
1821
+ ImageDefault: BubbleMenuImageDefault
1822
+ });
1823
+ //#endregion
1824
+ //#region src/ui/slash-command/utils.ts
1825
+ function isInsideNode(editor, type) {
1826
+ const { $from } = editor.state.selection;
1827
+ for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === type) return true;
1828
+ return false;
1829
+ }
1830
+ function isAtMaxColumnsDepth(editor) {
1831
+ const { from } = editor.state.selection;
1832
+ return require_columns.getColumnsDepth(editor.state.doc, from) >= 3;
1833
+ }
1834
+ function updateScrollView(container, item) {
1835
+ const containerRect = container.getBoundingClientRect();
1836
+ const itemRect = item.getBoundingClientRect();
1837
+ if (itemRect.top < containerRect.top) container.scrollTop -= containerRect.top - itemRect.top;
1838
+ else if (itemRect.bottom > containerRect.bottom) container.scrollTop += itemRect.bottom - containerRect.bottom;
1839
+ }
1840
+ //#endregion
1841
+ //#region src/ui/slash-command/command-list.tsx
1842
+ const CATEGORY_ORDER = [
1843
+ "Text",
1844
+ "Media",
1845
+ "Layout",
1846
+ "Utility"
1847
+ ];
1848
+ function groupByCategory(items) {
1849
+ const seen = /* @__PURE__ */ new Map();
1850
+ for (const item of items) {
1851
+ const existing = seen.get(item.category);
1852
+ if (existing) existing.push(item);
1853
+ else seen.set(item.category, [item]);
1854
+ }
1855
+ const ordered = [];
1856
+ for (const cat of CATEGORY_ORDER) {
1857
+ const group = seen.get(cat);
1858
+ if (group) {
1859
+ ordered.push({
1860
+ category: cat,
1861
+ items: group
1862
+ });
1863
+ seen.delete(cat);
1864
+ }
1865
+ }
1866
+ for (const [category, group] of seen) ordered.push({
1867
+ category,
1868
+ items: group
1869
+ });
1870
+ return ordered;
1871
+ }
1872
+ function CommandItem({ item, selected, onSelect }) {
1873
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1874
+ "data-re-slash-command-item": "",
1875
+ "data-selected": selected || void 0,
1876
+ onClick: onSelect,
1877
+ type: "button",
1878
+ children: [item.icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.title })]
1879
+ });
1880
+ }
1881
+ function CommandList({ items, query, selectedIndex, onSelect }) {
1882
+ const containerRef = (0, react.useRef)(null);
1883
+ (0, react.useLayoutEffect)(() => {
1884
+ const container = containerRef.current;
1885
+ if (!container) return;
1886
+ const selected = container.querySelector("[data-selected]");
1887
+ if (selected) updateScrollView(container, selected);
1888
+ }, [selectedIndex]);
1889
+ if (items.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1890
+ "data-re-slash-command": "",
1891
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1892
+ "data-re-slash-command-empty": "",
1893
+ children: "No results"
1894
+ })
1895
+ });
1896
+ if (query.trim().length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1897
+ "data-re-slash-command": "",
1898
+ ref: containerRef,
1899
+ children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
1900
+ item,
1901
+ onSelect: () => onSelect(index),
1902
+ selected: index === selectedIndex
1903
+ }, item.title))
1904
+ });
1905
+ const groups = groupByCategory(items);
1906
+ let flatIndex = 0;
1907
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1908
+ "data-re-slash-command": "",
1909
+ ref: containerRef,
1910
+ children: groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1911
+ "data-re-slash-command-category": "",
1912
+ children: group.category
1913
+ }), group.items.map((item) => {
1914
+ const currentIndex = flatIndex++;
1915
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
1916
+ item,
1917
+ onSelect: () => onSelect(currentIndex),
1918
+ selected: currentIndex === selectedIndex
1919
+ }, item.title);
1920
+ })] }, group.category))
1921
+ });
1922
+ }
1923
+ //#endregion
1924
+ //#region src/ui/slash-command/commands.tsx
1925
+ const TEXT = {
1926
+ title: "Text",
1927
+ description: "Plain text block",
1928
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextIcon, { size: 20 }),
1929
+ category: "Text",
1930
+ searchTerms: ["p", "paragraph"],
1931
+ command: ({ editor, range }) => {
1932
+ editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
1933
+ }
1934
+ };
1935
+ const H1 = {
1936
+ title: "Title",
1937
+ description: "Large heading",
1938
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading1Icon, { size: 20 }),
1939
+ category: "Text",
1940
+ searchTerms: [
1941
+ "title",
1942
+ "big",
1943
+ "large",
1944
+ "h1"
1945
+ ],
1946
+ command: ({ editor, range }) => {
1947
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
1948
+ }
1949
+ };
1950
+ const H2 = {
1951
+ title: "Subtitle",
1952
+ description: "Medium heading",
1953
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading2Icon, { size: 20 }),
1954
+ category: "Text",
1955
+ searchTerms: [
1956
+ "subtitle",
1957
+ "medium",
1958
+ "h2"
1959
+ ],
1960
+ command: ({ editor, range }) => {
1961
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
1962
+ }
1963
+ };
1964
+ const H3 = {
1965
+ title: "Heading",
1966
+ description: "Small heading",
1967
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading3Icon, { size: 20 }),
1968
+ category: "Text",
1969
+ searchTerms: [
1970
+ "subtitle",
1971
+ "small",
1972
+ "h3"
1973
+ ],
1974
+ command: ({ editor, range }) => {
1975
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
1976
+ }
1977
+ };
1978
+ const BULLET_LIST = {
1979
+ title: "Bullet list",
1980
+ description: "Unordered list",
1981
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListIcon, { size: 20 }),
1982
+ category: "Text",
1983
+ searchTerms: ["unordered", "point"],
1984
+ command: ({ editor, range }) => {
1985
+ editor.chain().focus().deleteRange(range).toggleBulletList().run();
1986
+ }
1987
+ };
1988
+ const NUMBERED_LIST = {
1989
+ title: "Numbered list",
1990
+ description: "Ordered list",
1991
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListOrderedIcon, { size: 20 }),
1992
+ category: "Text",
1993
+ searchTerms: ["ordered"],
1994
+ command: ({ editor, range }) => {
1995
+ editor.chain().focus().deleteRange(range).toggleOrderedList().run();
1996
+ }
1997
+ };
1998
+ const QUOTE = {
1999
+ title: "Quote",
2000
+ description: "Block quote",
2001
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextQuoteIcon, { size: 20 }),
2002
+ category: "Text",
2003
+ searchTerms: ["blockquote"],
2004
+ command: ({ editor, range }) => {
2005
+ editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").toggleBlockquote().run();
2006
+ }
2007
+ };
2008
+ const CODE = {
2009
+ title: "Code block",
2010
+ description: "Code snippet",
2011
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareCodeIcon, { size: 20 }),
2012
+ category: "Text",
2013
+ searchTerms: ["codeblock"],
2014
+ command: ({ editor, range }) => {
2015
+ editor.chain().focus().deleteRange(range).toggleCodeBlock().run();
2016
+ }
2017
+ };
2018
+ const BUTTON = {
2019
+ title: "Button",
2020
+ description: "Clickable button",
2021
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MousePointerIcon, { size: 20 }),
2022
+ category: "Layout",
2023
+ searchTerms: ["button"],
2024
+ command: ({ editor, range }) => {
2025
+ editor.chain().focus().deleteRange(range).setButton().run();
2026
+ }
2027
+ };
2028
+ const DIVIDER = {
2029
+ title: "Divider",
2030
+ description: "Horizontal separator",
2031
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitSquareVerticalIcon, { size: 20 }),
2032
+ category: "Layout",
2033
+ searchTerms: [
2034
+ "hr",
2035
+ "divider",
2036
+ "separator"
2037
+ ],
2038
+ command: ({ editor, range }) => {
2039
+ editor.chain().focus().deleteRange(range).setHorizontalRule().run();
2040
+ }
2041
+ };
2042
+ const SECTION = {
2043
+ title: "Section",
2044
+ description: "Content section",
2045
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rows2Icon, { size: 20 }),
2046
+ category: "Layout",
2047
+ searchTerms: [
2048
+ "section",
2049
+ "row",
2050
+ "container"
2051
+ ],
2052
+ command: ({ editor, range }) => {
2053
+ editor.chain().focus().deleteRange(range).insertSection().run();
2054
+ }
2055
+ };
2056
+ const TWO_COLUMNS = {
2057
+ title: "2 columns",
2058
+ description: "Two column layout",
2059
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Columns2Icon, { size: 20 }),
2060
+ category: "Layout",
2061
+ searchTerms: [
2062
+ "columns",
2063
+ "column",
2064
+ "layout",
2065
+ "grid",
2066
+ "split",
2067
+ "side-by-side",
2068
+ "multi-column",
2069
+ "row",
2070
+ "two",
2071
+ "2"
2072
+ ],
2073
+ command: ({ editor, range }) => {
2074
+ editor.chain().focus().deleteRange(range).insertColumns(2).run();
2075
+ }
2076
+ };
2077
+ const THREE_COLUMNS = {
2078
+ title: "3 columns",
2079
+ description: "Three column layout",
2080
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Columns3Icon, { size: 20 }),
2081
+ category: "Layout",
2082
+ searchTerms: [
2083
+ "columns",
2084
+ "column",
2085
+ "layout",
2086
+ "grid",
2087
+ "split",
2088
+ "multi-column",
2089
+ "row",
2090
+ "three",
2091
+ "3"
2092
+ ],
2093
+ command: ({ editor, range }) => {
2094
+ editor.chain().focus().deleteRange(range).insertColumns(3).run();
2095
+ }
2096
+ };
2097
+ const FOUR_COLUMNS = {
2098
+ title: "4 columns",
2099
+ description: "Four column layout",
2100
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Columns4Icon, { size: 20 }),
2101
+ category: "Layout",
2102
+ searchTerms: [
2103
+ "columns",
2104
+ "column",
2105
+ "layout",
2106
+ "grid",
2107
+ "split",
2108
+ "multi-column",
2109
+ "row",
2110
+ "four",
2111
+ "4"
2112
+ ],
2113
+ command: ({ editor, range }) => {
2114
+ editor.chain().focus().deleteRange(range).insertColumns(4).run();
2115
+ }
2116
+ };
2117
+ const defaultSlashCommands = [
2118
+ TEXT,
2119
+ H1,
2120
+ H2,
2121
+ H3,
2122
+ BULLET_LIST,
2123
+ NUMBERED_LIST,
2124
+ QUOTE,
2125
+ CODE,
2126
+ BUTTON,
2127
+ DIVIDER,
2128
+ SECTION,
2129
+ TWO_COLUMNS,
2130
+ THREE_COLUMNS,
2131
+ FOUR_COLUMNS
2132
+ ];
2133
+ //#endregion
2134
+ //#region src/ui/slash-command/search.ts
2135
+ function scoreItem(item, query) {
2136
+ if (!query) return 100;
2137
+ const q = query.toLowerCase();
2138
+ const title = item.title.toLowerCase();
2139
+ const description = item.description.toLowerCase();
2140
+ const terms = item.searchTerms?.map((t) => t.toLowerCase()) ?? [];
2141
+ if (title === q) return 100;
2142
+ if (title.startsWith(q)) return 90;
2143
+ if (title.split(/\s+/).some((w) => w.startsWith(q))) return 80;
2144
+ if (terms.some((t) => t === q)) return 70;
2145
+ if (terms.some((t) => t.startsWith(q))) return 60;
2146
+ if (title.includes(q)) return 40;
2147
+ if (terms.some((t) => t.includes(q))) return 30;
2148
+ if (description.includes(q)) return 20;
2149
+ return 0;
2150
+ }
2151
+ function filterAndRankItems(items, query) {
2152
+ const trimmed = query.trim();
2153
+ if (!trimmed) return items;
2154
+ const scored = items.map((item) => ({
2155
+ item,
2156
+ score: scoreItem(item, trimmed)
2157
+ })).filter(({ score }) => score > 0);
2158
+ scored.sort((a, b) => b.score - a.score);
2159
+ return scored.map(({ item }) => item);
2160
+ }
2161
+ //#endregion
2162
+ //#region src/ui/slash-command/root.tsx
2163
+ const pluginKey = new _tiptap_pm_state.PluginKey("slash-command");
2164
+ const INITIAL_STATE = {
2165
+ active: false,
2166
+ query: "",
2167
+ items: [],
2168
+ clientRect: null
2169
+ };
2170
+ function defaultFilterItems(items, query, editor) {
2171
+ return filterAndRankItems(isAtMaxColumnsDepth(editor) ? items.filter((item) => item.category !== "Layout" || !item.title.includes("column")) : items, query);
2172
+ }
2173
+ function SlashCommandRoot({ items: itemsProp, filterItems: filterItemsProp, char = "/", allow: allowProp, children }) {
2174
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
2175
+ const [state, setState] = (0, react.useState)(INITIAL_STATE);
2176
+ const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
2177
+ const itemsRef = (0, react.useRef)(itemsProp ?? defaultSlashCommands);
2178
+ const filterRef = (0, react.useRef)(filterItemsProp ?? defaultFilterItems);
2179
+ const allowRef = (0, react.useRef)(allowProp ?? (({ editor: e }) => !e.isActive("codeBlock")));
2180
+ itemsRef.current = itemsProp ?? defaultSlashCommands;
2181
+ filterRef.current = filterItemsProp ?? defaultFilterItems;
2182
+ allowRef.current = allowProp ?? (({ editor: e }) => !e.isActive("codeBlock"));
2183
+ const commandRef = (0, react.useRef)(null);
2184
+ const suggestionItemsRef = (0, react.useRef)([]);
2185
+ const selectedIndexRef = (0, react.useRef)(0);
2186
+ suggestionItemsRef.current = state.items;
2187
+ selectedIndexRef.current = selectedIndex;
2188
+ const { refs, floatingStyles } = (0, _floating_ui_react_dom.useFloating)({
2189
+ open: state.active,
2190
+ placement: "bottom-start",
2191
+ middleware: [
2192
+ (0, _floating_ui_react_dom.offset)(8),
2193
+ (0, _floating_ui_react_dom.flip)(),
2194
+ (0, _floating_ui_react_dom.shift)({ padding: 8 })
2195
+ ],
2196
+ whileElementsMounted: _floating_ui_react_dom.autoUpdate
2197
+ });
2198
+ (0, react.useEffect)(() => {
2199
+ if (!state.clientRect) return;
2200
+ const clientRect = state.clientRect;
2201
+ refs.setReference({ getBoundingClientRect: () => clientRect() });
2202
+ }, [state.clientRect, refs]);
2203
+ (0, react.useEffect)(() => {
2204
+ setSelectedIndex(0);
2205
+ }, [state.items]);
2206
+ const onSelect = (0, react.useCallback)((index) => {
2207
+ const item = suggestionItemsRef.current[index];
2208
+ if (item && commandRef.current) commandRef.current(item);
2209
+ }, []);
2210
+ (0, react.useEffect)(() => {
2211
+ if (!editor) return;
2212
+ const plugin = (0, _tiptap_suggestion.default)({
2213
+ pluginKey,
2214
+ editor,
2215
+ char,
2216
+ allow: ({ editor: e }) => allowRef.current({ editor: e }),
2217
+ command: ({ editor: e, range, props }) => {
2218
+ props.command({
2219
+ editor: e,
2220
+ range
2221
+ });
2222
+ },
2223
+ items: ({ query, editor: e }) => filterRef.current(itemsRef.current, query, e),
2224
+ render: () => ({
2225
+ onStart: (props) => {
2226
+ commandRef.current = props.command;
2227
+ setState({
2228
+ active: true,
2229
+ query: props.query,
2230
+ items: props.items,
2231
+ clientRect: props.clientRect ?? null
2232
+ });
2233
+ },
2234
+ onUpdate: (props) => {
2235
+ commandRef.current = props.command;
2236
+ setState({
2237
+ active: true,
2238
+ query: props.query,
2239
+ items: props.items,
2240
+ clientRect: props.clientRect ?? null
2241
+ });
2242
+ },
2243
+ onKeyDown: ({ event }) => {
2244
+ if (event.key === "Escape") {
2245
+ setState(INITIAL_STATE);
2246
+ return true;
2247
+ }
2248
+ const items = suggestionItemsRef.current;
2249
+ if (items.length === 0) return false;
2250
+ if (event.key === "ArrowUp") {
2251
+ setSelectedIndex((i) => (i + items.length - 1) % items.length);
2252
+ return true;
2253
+ }
2254
+ if (event.key === "ArrowDown") {
2255
+ setSelectedIndex((i) => (i + 1) % items.length);
2256
+ return true;
2257
+ }
2258
+ if (event.key === "Enter") {
2259
+ const item = items[selectedIndexRef.current];
2260
+ if (item && commandRef.current) commandRef.current(item);
2261
+ return true;
2262
+ }
2263
+ return false;
2264
+ },
2265
+ onExit: () => {
2266
+ setState(INITIAL_STATE);
2267
+ requestAnimationFrame(() => {
2268
+ commandRef.current = null;
2269
+ });
2270
+ }
2271
+ })
2272
+ });
2273
+ editor.registerPlugin(plugin, (newPlugin, plugins) => [newPlugin, ...plugins]);
2274
+ return () => {
2275
+ editor.unregisterPlugin(pluginKey);
2276
+ };
2277
+ }, [editor, char]);
2278
+ if (!editor || !state.active) return null;
2279
+ const renderProps = {
2280
+ items: state.items,
2281
+ query: state.query,
2282
+ selectedIndex,
2283
+ onSelect
2284
+ };
2285
+ let content;
2286
+ if (children) content = children(renderProps);
2287
+ else content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandList, { ...renderProps });
2288
+ return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2289
+ ref: refs.setFloating,
2290
+ style: floatingStyles,
2291
+ children: content
2292
+ }), document.body);
2293
+ }
2294
+ //#endregion
2295
+ Object.defineProperty(exports, "AlignCenterIcon", {
2296
+ enumerable: true,
2297
+ get: function() {
2298
+ return AlignCenterIcon;
2299
+ }
2300
+ });
2301
+ Object.defineProperty(exports, "AlignLeftIcon", {
2302
+ enumerable: true,
2303
+ get: function() {
2304
+ return AlignLeftIcon;
2305
+ }
2306
+ });
2307
+ Object.defineProperty(exports, "AlignRightIcon", {
2308
+ enumerable: true,
2309
+ get: function() {
2310
+ return AlignRightIcon;
2311
+ }
2312
+ });
2313
+ Object.defineProperty(exports, "BULLET_LIST", {
2314
+ enumerable: true,
2315
+ get: function() {
2316
+ return BULLET_LIST;
2317
+ }
2318
+ });
2319
+ Object.defineProperty(exports, "BUTTON", {
2320
+ enumerable: true,
2321
+ get: function() {
2322
+ return BUTTON;
2323
+ }
2324
+ });
2325
+ Object.defineProperty(exports, "BoldIcon", {
2326
+ enumerable: true,
2327
+ get: function() {
2328
+ return BoldIcon;
2329
+ }
2330
+ });
2331
+ Object.defineProperty(exports, "BubbleMenu", {
2332
+ enumerable: true,
2333
+ get: function() {
2334
+ return BubbleMenu;
2335
+ }
2336
+ });
2337
+ Object.defineProperty(exports, "BubbleMenuAlignCenter", {
2338
+ enumerable: true,
2339
+ get: function() {
2340
+ return BubbleMenuAlignCenter;
2341
+ }
2342
+ });
2343
+ Object.defineProperty(exports, "BubbleMenuAlignLeft", {
2344
+ enumerable: true,
2345
+ get: function() {
2346
+ return BubbleMenuAlignLeft;
2347
+ }
2348
+ });
2349
+ Object.defineProperty(exports, "BubbleMenuAlignRight", {
2350
+ enumerable: true,
2351
+ get: function() {
2352
+ return BubbleMenuAlignRight;
2353
+ }
2354
+ });
2355
+ Object.defineProperty(exports, "BubbleMenuBold", {
2356
+ enumerable: true,
2357
+ get: function() {
2358
+ return BubbleMenuBold;
2359
+ }
2360
+ });
2361
+ Object.defineProperty(exports, "BubbleMenuButtonDefault", {
2362
+ enumerable: true,
2363
+ get: function() {
2364
+ return BubbleMenuButtonDefault;
2365
+ }
2366
+ });
2367
+ Object.defineProperty(exports, "BubbleMenuButtonEditLink", {
2368
+ enumerable: true,
2369
+ get: function() {
2370
+ return BubbleMenuButtonEditLink;
2371
+ }
2372
+ });
2373
+ Object.defineProperty(exports, "BubbleMenuButtonForm", {
2374
+ enumerable: true,
2375
+ get: function() {
2376
+ return BubbleMenuButtonForm;
2377
+ }
2378
+ });
2379
+ Object.defineProperty(exports, "BubbleMenuButtonToolbar", {
2380
+ enumerable: true,
2381
+ get: function() {
2382
+ return BubbleMenuButtonToolbar;
2383
+ }
2384
+ });
2385
+ Object.defineProperty(exports, "BubbleMenuButtonUnlink", {
2386
+ enumerable: true,
2387
+ get: function() {
2388
+ return BubbleMenuButtonUnlink;
2389
+ }
2390
+ });
2391
+ Object.defineProperty(exports, "BubbleMenuCode", {
2392
+ enumerable: true,
2393
+ get: function() {
2394
+ return BubbleMenuCode;
2395
+ }
2396
+ });
2397
+ Object.defineProperty(exports, "BubbleMenuImageDefault", {
2398
+ enumerable: true,
2399
+ get: function() {
2400
+ return BubbleMenuImageDefault;
2401
+ }
2402
+ });
2403
+ Object.defineProperty(exports, "BubbleMenuImageEditLink", {
2404
+ enumerable: true,
2405
+ get: function() {
2406
+ return BubbleMenuImageEditLink;
2407
+ }
2408
+ });
2409
+ Object.defineProperty(exports, "BubbleMenuImageToolbar", {
2410
+ enumerable: true,
2411
+ get: function() {
2412
+ return BubbleMenuImageToolbar;
2413
+ }
2414
+ });
2415
+ Object.defineProperty(exports, "BubbleMenuItalic", {
2416
+ enumerable: true,
2417
+ get: function() {
2418
+ return BubbleMenuItalic;
2419
+ }
2420
+ });
2421
+ Object.defineProperty(exports, "BubbleMenuItem", {
2422
+ enumerable: true,
2423
+ get: function() {
2424
+ return BubbleMenuItem;
2425
+ }
2426
+ });
2427
+ Object.defineProperty(exports, "BubbleMenuItemGroup", {
2428
+ enumerable: true,
2429
+ get: function() {
2430
+ return BubbleMenuItemGroup;
2431
+ }
2432
+ });
2433
+ Object.defineProperty(exports, "BubbleMenuLinkDefault", {
2434
+ enumerable: true,
2435
+ get: function() {
2436
+ return BubbleMenuLinkDefault;
2437
+ }
2438
+ });
2439
+ Object.defineProperty(exports, "BubbleMenuLinkEditLink", {
2440
+ enumerable: true,
2441
+ get: function() {
2442
+ return BubbleMenuLinkEditLink;
2443
+ }
2444
+ });
2445
+ Object.defineProperty(exports, "BubbleMenuLinkForm", {
2446
+ enumerable: true,
2447
+ get: function() {
2448
+ return BubbleMenuLinkForm;
2449
+ }
2450
+ });
2451
+ Object.defineProperty(exports, "BubbleMenuLinkOpenLink", {
2452
+ enumerable: true,
2453
+ get: function() {
2454
+ return BubbleMenuLinkOpenLink;
2455
+ }
2456
+ });
2457
+ Object.defineProperty(exports, "BubbleMenuLinkSelector", {
2458
+ enumerable: true,
2459
+ get: function() {
2460
+ return BubbleMenuLinkSelector;
2461
+ }
2462
+ });
2463
+ Object.defineProperty(exports, "BubbleMenuLinkToolbar", {
2464
+ enumerable: true,
2465
+ get: function() {
2466
+ return BubbleMenuLinkToolbar;
2467
+ }
2468
+ });
2469
+ Object.defineProperty(exports, "BubbleMenuLinkUnlink", {
2470
+ enumerable: true,
2471
+ get: function() {
2472
+ return BubbleMenuLinkUnlink;
2473
+ }
2474
+ });
2475
+ Object.defineProperty(exports, "BubbleMenuNodeSelector", {
2476
+ enumerable: true,
2477
+ get: function() {
2478
+ return BubbleMenuNodeSelector;
2479
+ }
2480
+ });
2481
+ Object.defineProperty(exports, "BubbleMenuSeparator", {
2482
+ enumerable: true,
2483
+ get: function() {
2484
+ return BubbleMenuSeparator;
2485
+ }
2486
+ });
2487
+ Object.defineProperty(exports, "BubbleMenuStrike", {
2488
+ enumerable: true,
2489
+ get: function() {
2490
+ return BubbleMenuStrike;
2491
+ }
2492
+ });
2493
+ Object.defineProperty(exports, "BubbleMenuUnderline", {
2494
+ enumerable: true,
2495
+ get: function() {
2496
+ return BubbleMenuUnderline;
2497
+ }
2498
+ });
2499
+ Object.defineProperty(exports, "BubbleMenuUppercase", {
2500
+ enumerable: true,
2501
+ get: function() {
2502
+ return BubbleMenuUppercase;
2503
+ }
2504
+ });
2505
+ Object.defineProperty(exports, "CODE", {
2506
+ enumerable: true,
2507
+ get: function() {
2508
+ return CODE;
2509
+ }
2510
+ });
2511
+ Object.defineProperty(exports, "CaseUpperIcon", {
2512
+ enumerable: true,
2513
+ get: function() {
2514
+ return CaseUpperIcon;
2515
+ }
2516
+ });
2517
+ Object.defineProperty(exports, "CheckIcon", {
2518
+ enumerable: true,
2519
+ get: function() {
2520
+ return CheckIcon;
2521
+ }
2522
+ });
2523
+ Object.defineProperty(exports, "ChevronDownIcon", {
2524
+ enumerable: true,
2525
+ get: function() {
2526
+ return ChevronDownIcon;
2527
+ }
2528
+ });
2529
+ Object.defineProperty(exports, "CodeIcon", {
2530
+ enumerable: true,
2531
+ get: function() {
2532
+ return CodeIcon;
2533
+ }
2534
+ });
2535
+ Object.defineProperty(exports, "Columns2Icon", {
2536
+ enumerable: true,
2537
+ get: function() {
2538
+ return Columns2Icon;
2539
+ }
2540
+ });
2541
+ Object.defineProperty(exports, "Columns3Icon", {
2542
+ enumerable: true,
2543
+ get: function() {
2544
+ return Columns3Icon;
2545
+ }
2546
+ });
2547
+ Object.defineProperty(exports, "Columns4Icon", {
2548
+ enumerable: true,
2549
+ get: function() {
2550
+ return Columns4Icon;
2551
+ }
2552
+ });
2553
+ Object.defineProperty(exports, "DIVIDER", {
2554
+ enumerable: true,
2555
+ get: function() {
2556
+ return DIVIDER;
2557
+ }
2558
+ });
2559
+ Object.defineProperty(exports, "ExternalLinkIcon", {
2560
+ enumerable: true,
2561
+ get: function() {
2562
+ return ExternalLinkIcon;
2563
+ }
2564
+ });
2565
+ Object.defineProperty(exports, "FOUR_COLUMNS", {
2566
+ enumerable: true,
2567
+ get: function() {
2568
+ return FOUR_COLUMNS;
2569
+ }
2570
+ });
2571
+ Object.defineProperty(exports, "H1", {
2572
+ enumerable: true,
2573
+ get: function() {
2574
+ return H1;
2575
+ }
2576
+ });
2577
+ Object.defineProperty(exports, "H2", {
2578
+ enumerable: true,
2579
+ get: function() {
2580
+ return H2;
2581
+ }
2582
+ });
2583
+ Object.defineProperty(exports, "H3", {
2584
+ enumerable: true,
2585
+ get: function() {
2586
+ return H3;
2587
+ }
2588
+ });
2589
+ Object.defineProperty(exports, "Heading1Icon", {
2590
+ enumerable: true,
2591
+ get: function() {
2592
+ return Heading1Icon;
2593
+ }
2594
+ });
2595
+ Object.defineProperty(exports, "Heading2Icon", {
2596
+ enumerable: true,
2597
+ get: function() {
2598
+ return Heading2Icon;
2599
+ }
2600
+ });
2601
+ Object.defineProperty(exports, "Heading3Icon", {
2602
+ enumerable: true,
2603
+ get: function() {
2604
+ return Heading3Icon;
2605
+ }
2606
+ });
2607
+ Object.defineProperty(exports, "ItalicIcon", {
2608
+ enumerable: true,
2609
+ get: function() {
2610
+ return ItalicIcon;
2611
+ }
2612
+ });
2613
+ Object.defineProperty(exports, "LinkIcon", {
2614
+ enumerable: true,
2615
+ get: function() {
2616
+ return LinkIcon;
2617
+ }
2618
+ });
2619
+ Object.defineProperty(exports, "ListIcon", {
2620
+ enumerable: true,
2621
+ get: function() {
2622
+ return ListIcon;
2623
+ }
2624
+ });
2625
+ Object.defineProperty(exports, "ListOrderedIcon", {
2626
+ enumerable: true,
2627
+ get: function() {
2628
+ return ListOrderedIcon;
2629
+ }
2630
+ });
2631
+ Object.defineProperty(exports, "MousePointerIcon", {
2632
+ enumerable: true,
2633
+ get: function() {
2634
+ return MousePointerIcon;
2635
+ }
2636
+ });
2637
+ Object.defineProperty(exports, "NUMBERED_LIST", {
2638
+ enumerable: true,
2639
+ get: function() {
2640
+ return NUMBERED_LIST;
2641
+ }
2642
+ });
2643
+ Object.defineProperty(exports, "NodeSelectorContent", {
2644
+ enumerable: true,
2645
+ get: function() {
2646
+ return NodeSelectorContent;
2647
+ }
2648
+ });
2649
+ Object.defineProperty(exports, "NodeSelectorRoot", {
2650
+ enumerable: true,
2651
+ get: function() {
2652
+ return NodeSelectorRoot;
2653
+ }
2654
+ });
2655
+ Object.defineProperty(exports, "NodeSelectorTrigger", {
2656
+ enumerable: true,
2657
+ get: function() {
2658
+ return NodeSelectorTrigger;
2659
+ }
2660
+ });
2661
+ Object.defineProperty(exports, "PencilIcon", {
2662
+ enumerable: true,
2663
+ get: function() {
2664
+ return PencilIcon;
2665
+ }
2666
+ });
2667
+ Object.defineProperty(exports, "QUOTE", {
2668
+ enumerable: true,
2669
+ get: function() {
2670
+ return QUOTE;
2671
+ }
2672
+ });
2673
+ Object.defineProperty(exports, "RootWithDefault", {
2674
+ enumerable: true,
2675
+ get: function() {
2676
+ return RootWithDefault;
2677
+ }
2678
+ });
2679
+ Object.defineProperty(exports, "Rows2Icon", {
2680
+ enumerable: true,
2681
+ get: function() {
2682
+ return Rows2Icon;
2683
+ }
2684
+ });
2685
+ Object.defineProperty(exports, "SECTION", {
2686
+ enumerable: true,
2687
+ get: function() {
2688
+ return SECTION;
2689
+ }
2690
+ });
2691
+ Object.defineProperty(exports, "SlashCommandRoot", {
2692
+ enumerable: true,
2693
+ get: function() {
2694
+ return SlashCommandRoot;
2695
+ }
2696
+ });
2697
+ Object.defineProperty(exports, "SplitSquareVerticalIcon", {
2698
+ enumerable: true,
2699
+ get: function() {
2700
+ return SplitSquareVerticalIcon;
2701
+ }
2702
+ });
2703
+ Object.defineProperty(exports, "SquareCodeIcon", {
2704
+ enumerable: true,
2705
+ get: function() {
2706
+ return SquareCodeIcon;
2707
+ }
2708
+ });
2709
+ Object.defineProperty(exports, "StrikethroughIcon", {
2710
+ enumerable: true,
2711
+ get: function() {
2712
+ return StrikethroughIcon;
2713
+ }
2714
+ });
2715
+ Object.defineProperty(exports, "TEXT", {
2716
+ enumerable: true,
2717
+ get: function() {
2718
+ return TEXT;
2719
+ }
2720
+ });
2721
+ Object.defineProperty(exports, "THREE_COLUMNS", {
2722
+ enumerable: true,
2723
+ get: function() {
2724
+ return THREE_COLUMNS;
2725
+ }
2726
+ });
2727
+ Object.defineProperty(exports, "TWO_COLUMNS", {
2728
+ enumerable: true,
2729
+ get: function() {
2730
+ return TWO_COLUMNS;
2731
+ }
2732
+ });
2733
+ Object.defineProperty(exports, "TextIcon", {
2734
+ enumerable: true,
2735
+ get: function() {
2736
+ return TextIcon;
2737
+ }
2738
+ });
2739
+ Object.defineProperty(exports, "TextQuoteIcon", {
2740
+ enumerable: true,
2741
+ get: function() {
2742
+ return TextQuoteIcon;
2743
+ }
2744
+ });
2745
+ Object.defineProperty(exports, "UnderlineIcon", {
2746
+ enumerable: true,
2747
+ get: function() {
2748
+ return UnderlineIcon;
2749
+ }
2750
+ });
2751
+ Object.defineProperty(exports, "UnlinkIcon", {
2752
+ enumerable: true,
2753
+ get: function() {
2754
+ return UnlinkIcon;
2755
+ }
2756
+ });
2757
+ Object.defineProperty(exports, "bubbleMenuTriggers", {
2758
+ enumerable: true,
2759
+ get: function() {
2760
+ return bubbleMenuTriggers;
2761
+ }
2762
+ });
2763
+ Object.defineProperty(exports, "defaultSlashCommands", {
2764
+ enumerable: true,
2765
+ get: function() {
2766
+ return defaultSlashCommands;
2767
+ }
2768
+ });
2769
+ Object.defineProperty(exports, "filterAndRankItems", {
2770
+ enumerable: true,
2771
+ get: function() {
2772
+ return filterAndRankItems;
2773
+ }
2774
+ });
2775
+ Object.defineProperty(exports, "isAtMaxColumnsDepth", {
2776
+ enumerable: true,
2777
+ get: function() {
2778
+ return isAtMaxColumnsDepth;
2779
+ }
2780
+ });
2781
+ Object.defineProperty(exports, "isInsideNode", {
2782
+ enumerable: true,
2783
+ get: function() {
2784
+ return isInsideNode;
2785
+ }
2786
+ });
2787
+ Object.defineProperty(exports, "scoreItem", {
2788
+ enumerable: true,
2789
+ get: function() {
2790
+ return scoreItem;
2791
+ }
2792
+ });
2793
+ Object.defineProperty(exports, "useBubbleMenuContext", {
2794
+ enumerable: true,
2795
+ get: function() {
2796
+ return useBubbleMenuContext;
2797
+ }
2798
+ });