@react-email/editor 0.0.0-canary.49

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