@react-email/editor 0.0.0-experimental.34 → 0.0.0-experimental.37

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 (68) hide show
  1. package/dist/core/index.cjs +8 -7
  2. package/dist/core/index.d.cts +2 -2
  3. package/dist/core/index.d.mts +3 -2
  4. package/dist/core/index.mjs +3 -3
  5. package/dist/create-paste-handler-B8BtjBk3.d.cts +14 -0
  6. package/dist/create-paste-handler-B8BtjBk3.d.cts.map +1 -0
  7. package/dist/create-paste-handler-CGR738bC.d.mts +14 -0
  8. package/dist/create-paste-handler-CGR738bC.d.mts.map +1 -0
  9. package/dist/{columns-Cos2lqfu.mjs → event-bus-CHEzOS_O.mjs} +45 -45
  10. package/dist/event-bus-CHEzOS_O.mjs.map +1 -0
  11. package/dist/{columns-BXN-NNd4.cjs → event-bus-fb8U7hrl.cjs} +42 -42
  12. package/dist/extension-B8yvCdun.cjs +1248 -0
  13. package/dist/extension-XZBBjuHO.mjs +1123 -0
  14. package/dist/extension-XZBBjuHO.mjs.map +1 -0
  15. package/dist/extensions/index.cjs +45 -45
  16. package/dist/extensions/index.d.cts +2 -41
  17. package/dist/extensions/index.d.cts.map +1 -1
  18. package/dist/extensions/index.d.mts +3 -41
  19. package/dist/extensions/index.d.mts.map +1 -1
  20. package/dist/extensions/index.mjs +3 -3
  21. package/dist/{core-mUMTkab3.mjs → extensions-DWsu9kwZ.mjs} +221 -221
  22. package/dist/extensions-DWsu9kwZ.mjs.map +1 -0
  23. package/dist/{core-DVox_fis.cjs → extensions-aMMnHcs9.cjs} +298 -280
  24. package/dist/{global-content-kdUzYcsA.mjs → global-content-5rAU84QT.mjs} +1 -1
  25. package/dist/{global-content-kdUzYcsA.mjs.map → global-content-5rAU84QT.mjs.map} +1 -1
  26. package/dist/{global-content-BRvA4PRG.cjs → global-content-62RO9uoQ.cjs} +1 -1
  27. package/dist/{index-CVRlPqX_.d.cts → index-C4KcMQ0R.d.cts} +43 -13
  28. package/dist/index-C4KcMQ0R.d.cts.map +1 -0
  29. package/dist/{index-BrSAA0dn.d.mts → index-CxX7W63O.d.mts} +43 -13
  30. package/dist/index-CxX7W63O.d.mts.map +1 -0
  31. package/dist/index.cjs +74 -0
  32. package/dist/index.css +859 -0
  33. package/dist/index.css.map +1 -0
  34. package/dist/index.d.cts +33 -0
  35. package/dist/index.d.cts.map +1 -0
  36. package/dist/index.d.mts +33 -0
  37. package/dist/index.d.mts.map +1 -0
  38. package/dist/index.mjs +74 -0
  39. package/dist/index.mjs.map +1 -0
  40. package/dist/plugins/index.cjs +22 -1114
  41. package/dist/plugins/index.d.cts +16 -1
  42. package/dist/plugins/index.d.cts.map +1 -1
  43. package/dist/plugins/index.d.mts +17 -2
  44. package/dist/plugins/index.d.mts.map +1 -1
  45. package/dist/plugins/index.mjs +2 -1097
  46. package/dist/root-BMxsq1NF.mjs +2401 -0
  47. package/dist/root-BMxsq1NF.mjs.map +1 -0
  48. package/dist/root-CNVO39XG.cjs +2941 -0
  49. package/dist/{set-text-alignment-BO24ieeE.mjs → set-text-alignment-GMXOPMlJ.mjs} +1 -1
  50. package/dist/{set-text-alignment-BO24ieeE.mjs.map → set-text-alignment-GMXOPMlJ.mjs.map} +1 -1
  51. package/dist/{styles-DLviD0JK.mjs → styles-_TMw3YxC.mjs} +1 -1
  52. package/dist/{styles-DLviD0JK.mjs.map → styles-_TMw3YxC.mjs.map} +1 -1
  53. package/dist/ui/index.cjs +128 -2515
  54. package/dist/ui/index.d.cts +97 -102
  55. package/dist/ui/index.d.cts.map +1 -1
  56. package/dist/ui/index.d.mts +98 -103
  57. package/dist/ui/index.d.mts.map +1 -1
  58. package/dist/ui/index.mjs +2 -2388
  59. package/dist/ui/index.mjs.map +1 -1
  60. package/dist/utils/index.cjs +1 -1
  61. package/dist/utils/index.mjs +1 -1
  62. package/package.json +12 -2
  63. package/dist/columns-Cos2lqfu.mjs.map +0 -1
  64. package/dist/core-mUMTkab3.mjs.map +0 -1
  65. package/dist/index-BrSAA0dn.d.mts.map +0 -1
  66. package/dist/index-CVRlPqX_.d.cts.map +0 -1
  67. package/dist/plugins/index.mjs.map +0 -1
  68. /package/dist/{set-text-alignment-CbECklB4.cjs → set-text-alignment-aNb7Ml9N.cjs} +0 -0
@@ -0,0 +1,2941 @@
1
+ const require_event_bus = require('./event-bus-fb8U7hrl.cjs');
2
+ const require_set_text_alignment = require('./set-text-alignment-aNb7Ml9N.cjs');
3
+ let _tiptap_react = require("@tiptap/react");
4
+ let react = require("react");
5
+ react = require_event_bus.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let _tiptap_pm_state = require("@tiptap/pm/state");
8
+ let _radix_ui_react_popover = require("@radix-ui/react-popover");
9
+ _radix_ui_react_popover = require_event_bus.__toESM(_radix_ui_react_popover);
10
+ let _tiptap_react_menus = require("@tiptap/react/menus");
11
+ let _floating_ui_react_dom = require("@floating-ui/react-dom");
12
+ let _tiptap_suggestion = require("@tiptap/suggestion");
13
+ _tiptap_suggestion = require_event_bus.__toESM(_tiptap_suggestion);
14
+ let react_dom = require("react-dom");
15
+
16
+ //#region src/ui/icons/align-center.tsx
17
+ function AlignCenterIcon({ size, width, height, ...props }) {
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
19
+ xmlns: "http://www.w3.org/2000/svg",
20
+ width: size ?? width ?? 24,
21
+ height: size ?? height ?? 24,
22
+ viewBox: "0 0 24 24",
23
+ fill: "none",
24
+ stroke: "currentColor",
25
+ strokeWidth: 2,
26
+ strokeLinecap: "round",
27
+ strokeLinejoin: "round",
28
+ "aria-hidden": "true",
29
+ ...props,
30
+ children: [
31
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 12H7" }),
33
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 19H5" })
34
+ ]
35
+ });
36
+ }
37
+
38
+ //#endregion
39
+ //#region src/ui/icons/align-left.tsx
40
+ function AlignLeftIcon({ size, width, height, ...props }) {
41
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ width: size ?? width ?? 24,
44
+ height: size ?? height ?? 24,
45
+ viewBox: "0 0 24 24",
46
+ fill: "none",
47
+ stroke: "currentColor",
48
+ strokeWidth: 2,
49
+ strokeLinecap: "round",
50
+ strokeLinejoin: "round",
51
+ "aria-hidden": "true",
52
+ ...props,
53
+ children: [
54
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
55
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 12H3" }),
56
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 19H3" })
57
+ ]
58
+ });
59
+ }
60
+
61
+ //#endregion
62
+ //#region src/ui/icons/align-right.tsx
63
+ function AlignRightIcon({ size, width, height, ...props }) {
64
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ width: size ?? width ?? 24,
67
+ height: size ?? height ?? 24,
68
+ viewBox: "0 0 24 24",
69
+ fill: "none",
70
+ stroke: "currentColor",
71
+ strokeWidth: 2,
72
+ strokeLinecap: "round",
73
+ strokeLinejoin: "round",
74
+ "aria-hidden": "true",
75
+ ...props,
76
+ children: [
77
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 5H3" }),
78
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 12H9" }),
79
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 19H7" })
80
+ ]
81
+ });
82
+ }
83
+
84
+ //#endregion
85
+ //#region src/ui/icons/bold.tsx
86
+ function BoldIcon({ size, width, height, ...props }) {
87
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
88
+ xmlns: "http://www.w3.org/2000/svg",
89
+ width: size ?? width ?? 24,
90
+ height: size ?? height ?? 24,
91
+ viewBox: "0 0 24 24",
92
+ fill: "none",
93
+ stroke: "currentColor",
94
+ strokeWidth: 2,
95
+ strokeLinecap: "round",
96
+ strokeLinejoin: "round",
97
+ "aria-hidden": "true",
98
+ ...props,
99
+ 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" })
100
+ });
101
+ }
102
+
103
+ //#endregion
104
+ //#region src/ui/icons/case-upper.tsx
105
+ function CaseUpperIcon({ size, width, height, ...props }) {
106
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
107
+ xmlns: "http://www.w3.org/2000/svg",
108
+ width: size ?? width ?? 24,
109
+ height: size ?? height ?? 24,
110
+ viewBox: "0 0 24 24",
111
+ fill: "none",
112
+ stroke: "currentColor",
113
+ strokeWidth: 2,
114
+ strokeLinecap: "round",
115
+ strokeLinejoin: "round",
116
+ "aria-hidden": "true",
117
+ ...props,
118
+ children: [
119
+ /* @__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" }),
120
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16" }),
121
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.304 13h6.392" })
122
+ ]
123
+ });
124
+ }
125
+
126
+ //#endregion
127
+ //#region src/ui/icons/check.tsx
128
+ function Check({ size, width, height, ...props }) {
129
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
130
+ xmlns: "http://www.w3.org/2000/svg",
131
+ width: size ?? width ?? 24,
132
+ height: size ?? height ?? 24,
133
+ viewBox: "0 0 24 24",
134
+ fill: "none",
135
+ stroke: "currentColor",
136
+ strokeWidth: 2,
137
+ strokeLinecap: "round",
138
+ strokeLinejoin: "round",
139
+ "aria-hidden": "true",
140
+ ...props,
141
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M20 6 9 17l-5-5" })
142
+ });
143
+ }
144
+
145
+ //#endregion
146
+ //#region src/ui/icons/chevron-down.tsx
147
+ function ChevronDown({ size, width, height, ...props }) {
148
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
149
+ xmlns: "http://www.w3.org/2000/svg",
150
+ width: size ?? width ?? 24,
151
+ height: size ?? height ?? 24,
152
+ viewBox: "0 0 24 24",
153
+ fill: "none",
154
+ stroke: "currentColor",
155
+ strokeWidth: 2,
156
+ strokeLinecap: "round",
157
+ strokeLinejoin: "round",
158
+ "aria-hidden": "true",
159
+ ...props,
160
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 9 6 6 6-6" })
161
+ });
162
+ }
163
+
164
+ //#endregion
165
+ //#region src/ui/icons/code.tsx
166
+ function CodeIcon({ size, width, height, ...props }) {
167
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
168
+ xmlns: "http://www.w3.org/2000/svg",
169
+ width: size ?? width ?? 24,
170
+ height: size ?? height ?? 24,
171
+ viewBox: "0 0 24 24",
172
+ fill: "none",
173
+ stroke: "currentColor",
174
+ strokeWidth: 2,
175
+ strokeLinecap: "round",
176
+ strokeLinejoin: "round",
177
+ "aria-hidden": "true",
178
+ ...props,
179
+ 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" })]
180
+ });
181
+ }
182
+ const Code = CodeIcon;
183
+
184
+ //#endregion
185
+ //#region src/ui/icons/columns-2.tsx
186
+ function Columns2({ 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 Columns3({ 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 Columns4({ 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 Heading1({ 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 Heading2({ 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 Heading3({ 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 List({ 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 ListOrdered({ 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 MousePointer({ 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 Rows2({ 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 SplitSquareVertical({ 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 SquareCode({ 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
+ const Text = TextIcon;
644
+
645
+ //#endregion
646
+ //#region src/ui/icons/text-quote.tsx
647
+ function TextQuote({ size, width, height, ...props }) {
648
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
649
+ xmlns: "http://www.w3.org/2000/svg",
650
+ width: size ?? width ?? 24,
651
+ height: size ?? height ?? 24,
652
+ viewBox: "0 0 24 24",
653
+ fill: "none",
654
+ stroke: "currentColor",
655
+ strokeWidth: 2,
656
+ strokeLinecap: "round",
657
+ strokeLinejoin: "round",
658
+ "aria-hidden": "true",
659
+ ...props,
660
+ children: [
661
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M17 5H3" }),
662
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 12H8" }),
663
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 19H8" }),
664
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 12v7" })
665
+ ]
666
+ });
667
+ }
668
+
669
+ //#endregion
670
+ //#region src/ui/icons/underline.tsx
671
+ function UnderlineIcon({ size, width, height, ...props }) {
672
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
673
+ xmlns: "http://www.w3.org/2000/svg",
674
+ width: size ?? width ?? 24,
675
+ height: size ?? height ?? 24,
676
+ viewBox: "0 0 24 24",
677
+ fill: "none",
678
+ stroke: "currentColor",
679
+ strokeWidth: 2,
680
+ strokeLinecap: "round",
681
+ strokeLinejoin: "round",
682
+ "aria-hidden": "true",
683
+ ...props,
684
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
685
+ x1: "4",
686
+ x2: "20",
687
+ y1: "20",
688
+ y2: "20"
689
+ })]
690
+ });
691
+ }
692
+
693
+ //#endregion
694
+ //#region src/ui/icons/unlink.tsx
695
+ function UnlinkIcon({ size, width, height, ...props }) {
696
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
697
+ xmlns: "http://www.w3.org/2000/svg",
698
+ width: size ?? width ?? 24,
699
+ height: size ?? height ?? 24,
700
+ viewBox: "0 0 24 24",
701
+ fill: "none",
702
+ stroke: "currentColor",
703
+ strokeWidth: 2,
704
+ strokeLinecap: "round",
705
+ strokeLinejoin: "round",
706
+ "aria-hidden": "true",
707
+ ...props,
708
+ children: [
709
+ /* @__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" }),
710
+ /* @__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" }),
711
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
712
+ x1: "8",
713
+ x2: "8",
714
+ y1: "2",
715
+ y2: "5"
716
+ }),
717
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
718
+ x1: "2",
719
+ x2: "5",
720
+ y1: "8",
721
+ y2: "8"
722
+ }),
723
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
724
+ x1: "16",
725
+ x2: "16",
726
+ y1: "19",
727
+ y2: "22"
728
+ }),
729
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
730
+ x1: "19",
731
+ x2: "22",
732
+ y1: "16",
733
+ y2: "16"
734
+ })
735
+ ]
736
+ });
737
+ }
738
+
739
+ //#endregion
740
+ //#region src/ui/bubble-menu/context.tsx
741
+ const BubbleMenuContext = react.createContext(null);
742
+ function useBubbleMenuContext() {
743
+ const context = react.useContext(BubbleMenuContext);
744
+ if (!context) throw new Error("BubbleMenu compound components must be used within <BubbleMenu.Root>");
745
+ return context;
746
+ }
747
+
748
+ //#endregion
749
+ //#region src/ui/bubble-menu/item.tsx
750
+ function BubbleMenuItem({ name, isActive, onCommand, className, children, ...rest }) {
751
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
752
+ type: "button",
753
+ "aria-label": name,
754
+ "aria-pressed": isActive,
755
+ className,
756
+ "data-re-bubble-menu-item": "",
757
+ "data-item": name,
758
+ ...isActive ? { "data-active": "" } : {},
759
+ onMouseDown: (e) => e.preventDefault(),
760
+ onClick: onCommand,
761
+ ...rest,
762
+ children
763
+ });
764
+ }
765
+
766
+ //#endregion
767
+ //#region src/ui/bubble-menu/align-center.tsx
768
+ function BubbleMenuAlignCenter({ className, children }) {
769
+ const { editor } = useBubbleMenuContext();
770
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
771
+ name: "align-center",
772
+ isActive: (0, _tiptap_react.useEditorState)({
773
+ editor,
774
+ selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "center" }) ?? false
775
+ }),
776
+ onCommand: () => require_set_text_alignment.setTextAlignment(editor, "center"),
777
+ className,
778
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignCenterIcon, {})
779
+ });
780
+ }
781
+
782
+ //#endregion
783
+ //#region src/ui/bubble-menu/align-left.tsx
784
+ function BubbleMenuAlignLeft({ className, children }) {
785
+ const { editor } = useBubbleMenuContext();
786
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
787
+ name: "align-left",
788
+ isActive: (0, _tiptap_react.useEditorState)({
789
+ editor,
790
+ selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "left" }) ?? false
791
+ }),
792
+ onCommand: () => require_set_text_alignment.setTextAlignment(editor, "left"),
793
+ className,
794
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignLeftIcon, {})
795
+ });
796
+ }
797
+
798
+ //#endregion
799
+ //#region src/ui/bubble-menu/align-right.tsx
800
+ function BubbleMenuAlignRight({ className, children }) {
801
+ const { editor } = useBubbleMenuContext();
802
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
803
+ name: "align-right",
804
+ isActive: (0, _tiptap_react.useEditorState)({
805
+ editor,
806
+ selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "right" }) ?? false
807
+ }),
808
+ onCommand: () => require_set_text_alignment.setTextAlignment(editor, "right"),
809
+ className,
810
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignRightIcon, {})
811
+ });
812
+ }
813
+
814
+ //#endregion
815
+ //#region src/ui/bubble-menu/create-mark-bubble-item.tsx
816
+ function createMarkBubbleItem(config) {
817
+ function MarkBubbleItem({ className, children }) {
818
+ const { editor } = useBubbleMenuContext();
819
+ const isActive = (0, _tiptap_react.useEditorState)({
820
+ editor,
821
+ selector: ({ editor: editor$1 }) => {
822
+ if (config.activeParams) return editor$1?.isActive(config.activeName, config.activeParams) ?? false;
823
+ return editor$1?.isActive(config.activeName) ?? false;
824
+ }
825
+ });
826
+ const handleCommand = () => {
827
+ const chain = editor.chain().focus();
828
+ const method = chain[config.command];
829
+ if (method) method.call(chain).run();
830
+ };
831
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
832
+ name: config.name,
833
+ isActive,
834
+ onCommand: handleCommand,
835
+ className,
836
+ children: children ?? config.icon
837
+ });
838
+ }
839
+ MarkBubbleItem.displayName = `BubbleMenu${config.name.charAt(0).toUpperCase() + config.name.slice(1)}`;
840
+ return MarkBubbleItem;
841
+ }
842
+
843
+ //#endregion
844
+ //#region src/ui/bubble-menu/bold.tsx
845
+ const BubbleMenuBold = createMarkBubbleItem({
846
+ name: "bold",
847
+ activeName: "bold",
848
+ command: "toggleBold",
849
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoldIcon, {})
850
+ });
851
+
852
+ //#endregion
853
+ //#region src/ui/bubble-menu/code.tsx
854
+ const BubbleMenuCode = createMarkBubbleItem({
855
+ name: "code",
856
+ activeName: "code",
857
+ command: "toggleCode",
858
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeIcon, {})
859
+ });
860
+
861
+ //#endregion
862
+ //#region src/ui/bubble-menu/group.tsx
863
+ function BubbleMenuItemGroup({ className, children }) {
864
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("fieldset", {
865
+ className,
866
+ "data-re-bubble-menu-group": "",
867
+ children
868
+ });
869
+ }
870
+
871
+ //#endregion
872
+ //#region src/ui/bubble-menu/italic.tsx
873
+ const BubbleMenuItalic = createMarkBubbleItem({
874
+ name: "italic",
875
+ activeName: "italic",
876
+ command: "toggleItalic",
877
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItalicIcon, {})
878
+ });
879
+
880
+ //#endregion
881
+ //#region src/ui/bubble-menu/utils.ts
882
+ const SAFE_PROTOCOLS = new Set([
883
+ "http:",
884
+ "https:",
885
+ "mailto:",
886
+ "tel:"
887
+ ]);
888
+ /**
889
+ * Basic URL validation and auto-prefixing.
890
+ * Rejects dangerous schemes (javascript:, data:, vbscript:, etc.).
891
+ * Returns the valid URL string or null.
892
+ */
893
+ function getUrlFromString(str) {
894
+ if (str === "#") return str;
895
+ try {
896
+ const url = new URL(str);
897
+ if (SAFE_PROTOCOLS.has(url.protocol)) return str;
898
+ return null;
899
+ } catch {}
900
+ try {
901
+ if (str.includes(".") && !str.includes(" ")) return new URL(`https://${str}`).toString();
902
+ } catch {}
903
+ return null;
904
+ }
905
+ function setLinkHref(editor, href) {
906
+ if (href.length === 0) {
907
+ editor.chain().unsetLink().run();
908
+ return;
909
+ }
910
+ const { from, to } = editor.state.selection;
911
+ if (from === to) {
912
+ editor.chain().extendMarkRange("link").setLink({ href }).setTextSelection({
913
+ from,
914
+ to
915
+ }).run();
916
+ return;
917
+ }
918
+ editor.chain().setLink({ href }).run();
919
+ }
920
+ function focusEditor(editor) {
921
+ setTimeout(() => {
922
+ editor.commands.focus();
923
+ }, 0);
924
+ }
925
+
926
+ //#endregion
927
+ //#region src/ui/bubble-menu/link-selector.tsx
928
+ function BubbleMenuLinkSelector({ className, showToggle = true, validateUrl, onLinkApply, onLinkRemove, children, open: controlledOpen, onOpenChange }) {
929
+ const { editor } = useBubbleMenuContext();
930
+ const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
931
+ const isControlled = controlledOpen !== void 0;
932
+ const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
933
+ const setIsOpen = react.useCallback((value) => {
934
+ if (!isControlled) setUncontrolledOpen(value);
935
+ onOpenChange?.(value);
936
+ }, [isControlled, onOpenChange]);
937
+ const editorState = (0, _tiptap_react.useEditorState)({
938
+ editor,
939
+ selector: ({ editor: editor$1 }) => ({
940
+ isLinkActive: editor$1?.isActive("link") ?? false,
941
+ hasLink: Boolean(editor$1?.getAttributes("link").href),
942
+ currentHref: editor$1?.getAttributes("link").href || ""
943
+ })
944
+ });
945
+ const setIsOpenRef = react.useRef(setIsOpen);
946
+ setIsOpenRef.current = setIsOpen;
947
+ react.useEffect(() => {
948
+ const subscription = require_event_bus.editorEventBus.on("bubble-menu:add-link", () => {
949
+ setIsOpenRef.current(true);
950
+ });
951
+ return () => {
952
+ setIsOpenRef.current(false);
953
+ subscription.unsubscribe();
954
+ };
955
+ }, []);
956
+ if (!editorState) return null;
957
+ const handleOpenLink = () => {
958
+ setIsOpen(!isOpen);
959
+ };
960
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
961
+ "data-re-link-selector": "",
962
+ ...isOpen ? { "data-open": "" } : {},
963
+ ...editorState.hasLink ? { "data-has-link": "" } : {},
964
+ className,
965
+ children: [showToggle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
966
+ type: "button",
967
+ "aria-expanded": isOpen,
968
+ "aria-haspopup": "true",
969
+ "aria-label": "Add link",
970
+ "aria-pressed": editorState.isLinkActive && editorState.hasLink,
971
+ "data-re-link-selector-trigger": "",
972
+ onClick: handleOpenLink,
973
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkIcon, {})
974
+ }), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkForm, {
975
+ editor,
976
+ currentHref: editorState.currentHref,
977
+ validateUrl,
978
+ onLinkApply,
979
+ onLinkRemove,
980
+ setIsOpen,
981
+ children
982
+ })]
983
+ });
984
+ }
985
+ function LinkForm({ editor, currentHref, validateUrl, onLinkApply, onLinkRemove, setIsOpen, children }) {
986
+ const inputRef = react.useRef(null);
987
+ const formRef = react.useRef(null);
988
+ const displayHref = currentHref === "#" ? "" : currentHref;
989
+ const [inputValue, setInputValue] = react.useState(displayHref);
990
+ react.useEffect(() => {
991
+ const timeoutId = setTimeout(() => {
992
+ inputRef.current?.focus();
993
+ }, 0);
994
+ return () => clearTimeout(timeoutId);
995
+ }, []);
996
+ react.useEffect(() => {
997
+ const handleKeyDown = (event) => {
998
+ if (event.key === "Escape") {
999
+ if (editor.getAttributes("link").href === "#") editor.chain().unsetLink().run();
1000
+ setIsOpen(false);
1001
+ }
1002
+ };
1003
+ const handleClickOutside = (event) => {
1004
+ if (formRef.current && !formRef.current.contains(event.target)) {
1005
+ const form = formRef.current;
1006
+ const submitEvent = new Event("submit", {
1007
+ bubbles: true,
1008
+ cancelable: true
1009
+ });
1010
+ form.dispatchEvent(submitEvent);
1011
+ setIsOpen(false);
1012
+ }
1013
+ };
1014
+ document.addEventListener("mousedown", handleClickOutside);
1015
+ window.addEventListener("keydown", handleKeyDown);
1016
+ return () => {
1017
+ window.removeEventListener("keydown", handleKeyDown);
1018
+ document.removeEventListener("mousedown", handleClickOutside);
1019
+ };
1020
+ }, [editor, setIsOpen]);
1021
+ function handleSubmit(e) {
1022
+ e.preventDefault();
1023
+ const value = inputValue.trim();
1024
+ if (value === "") {
1025
+ setLinkHref(editor, "");
1026
+ setIsOpen(false);
1027
+ focusEditor(editor);
1028
+ onLinkRemove?.();
1029
+ return;
1030
+ }
1031
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1032
+ if (!finalValue) {
1033
+ setLinkHref(editor, "");
1034
+ setIsOpen(false);
1035
+ focusEditor(editor);
1036
+ onLinkRemove?.();
1037
+ return;
1038
+ }
1039
+ setLinkHref(editor, finalValue);
1040
+ setIsOpen(false);
1041
+ focusEditor(editor);
1042
+ onLinkApply?.(finalValue);
1043
+ }
1044
+ function handleUnlink(e) {
1045
+ e.stopPropagation();
1046
+ setLinkHref(editor, "");
1047
+ setIsOpen(false);
1048
+ focusEditor(editor);
1049
+ onLinkRemove?.();
1050
+ }
1051
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1052
+ ref: formRef,
1053
+ "data-re-link-selector-form": "",
1054
+ onMouseDown: (e) => e.stopPropagation(),
1055
+ onClick: (e) => e.stopPropagation(),
1056
+ onKeyDown: (e) => e.stopPropagation(),
1057
+ onSubmit: handleSubmit,
1058
+ children: [
1059
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1060
+ ref: inputRef,
1061
+ "data-re-link-selector-input": "",
1062
+ value: inputValue,
1063
+ onFocus: (e) => e.stopPropagation(),
1064
+ onChange: (e) => setInputValue(e.target.value),
1065
+ placeholder: "Paste a link",
1066
+ type: "text"
1067
+ }),
1068
+ children,
1069
+ displayHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1070
+ type: "button",
1071
+ "aria-label": "Remove link",
1072
+ "data-re-link-selector-unlink": "",
1073
+ onClick: handleUnlink,
1074
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1075
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1076
+ type: "submit",
1077
+ "aria-label": "Apply link",
1078
+ "data-re-link-selector-apply": "",
1079
+ onMouseDown: (e) => e.stopPropagation(),
1080
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {})
1081
+ })
1082
+ ]
1083
+ });
1084
+ }
1085
+
1086
+ //#endregion
1087
+ //#region src/ui/bubble-menu/node-selector.tsx
1088
+ const NodeSelectorContext = react.createContext(null);
1089
+ function useNodeSelectorContext() {
1090
+ const context = react.useContext(NodeSelectorContext);
1091
+ if (!context) throw new Error("NodeSelector compound components must be used within <NodeSelector.Root>");
1092
+ return context;
1093
+ }
1094
+ function NodeSelectorRoot({ omit = [], open: controlledOpen, onOpenChange, className, children }) {
1095
+ const { editor } = useBubbleMenuContext();
1096
+ const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
1097
+ const isControlled = controlledOpen !== void 0;
1098
+ const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
1099
+ const setIsOpen = react.useCallback((value) => {
1100
+ if (!isControlled) setUncontrolledOpen(value);
1101
+ onOpenChange?.(value);
1102
+ }, [isControlled, onOpenChange]);
1103
+ const editorState = (0, _tiptap_react.useEditorState)({
1104
+ editor,
1105
+ selector: ({ editor: editor$1 }) => ({
1106
+ isParagraphActive: (editor$1?.isActive("paragraph") ?? false) && !editor$1?.isActive("bulletList") && !editor$1?.isActive("orderedList"),
1107
+ isHeading1Active: editor$1?.isActive("heading", { level: 1 }) ?? false,
1108
+ isHeading2Active: editor$1?.isActive("heading", { level: 2 }) ?? false,
1109
+ isHeading3Active: editor$1?.isActive("heading", { level: 3 }) ?? false,
1110
+ isBulletListActive: editor$1?.isActive("bulletList") ?? false,
1111
+ isOrderedListActive: editor$1?.isActive("orderedList") ?? false,
1112
+ isBlockquoteActive: editor$1?.isActive("blockquote") ?? false,
1113
+ isCodeBlockActive: editor$1?.isActive("codeBlock") ?? false
1114
+ })
1115
+ });
1116
+ const allItems = react.useMemo(() => [
1117
+ {
1118
+ name: "Text",
1119
+ icon: TextIcon,
1120
+ command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").run(),
1121
+ isActive: editorState?.isParagraphActive ?? false
1122
+ },
1123
+ {
1124
+ name: "Title",
1125
+ icon: Heading1,
1126
+ command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
1127
+ isActive: editorState?.isHeading1Active ?? false
1128
+ },
1129
+ {
1130
+ name: "Subtitle",
1131
+ icon: Heading2,
1132
+ command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
1133
+ isActive: editorState?.isHeading2Active ?? false
1134
+ },
1135
+ {
1136
+ name: "Heading",
1137
+ icon: Heading3,
1138
+ command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
1139
+ isActive: editorState?.isHeading3Active ?? false
1140
+ },
1141
+ {
1142
+ name: "Bullet List",
1143
+ icon: List,
1144
+ command: () => editor.chain().focus().clearNodes().toggleBulletList().run(),
1145
+ isActive: editorState?.isBulletListActive ?? false
1146
+ },
1147
+ {
1148
+ name: "Numbered List",
1149
+ icon: ListOrdered,
1150
+ command: () => editor.chain().focus().clearNodes().toggleOrderedList().run(),
1151
+ isActive: editorState?.isOrderedListActive ?? false
1152
+ },
1153
+ {
1154
+ name: "Quote",
1155
+ icon: TextQuote,
1156
+ command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").toggleBlockquote().run(),
1157
+ isActive: editorState?.isBlockquoteActive ?? false
1158
+ },
1159
+ {
1160
+ name: "Code",
1161
+ icon: Code,
1162
+ command: () => editor.chain().focus().clearNodes().toggleCodeBlock().run(),
1163
+ isActive: editorState?.isCodeBlockActive ?? false
1164
+ }
1165
+ ], [editor, editorState]);
1166
+ const items = react.useMemo(() => allItems.filter((item) => !omit.includes(item.name)), [allItems, omit]);
1167
+ const activeItem = react.useMemo(() => items.find((item) => item.isActive) ?? { name: "Multiple" }, [items]);
1168
+ const contextValue = react.useMemo(() => ({
1169
+ items,
1170
+ activeItem,
1171
+ isOpen,
1172
+ setIsOpen
1173
+ }), [
1174
+ items,
1175
+ activeItem,
1176
+ isOpen,
1177
+ setIsOpen
1178
+ ]);
1179
+ if (!editorState || items.length === 0) return null;
1180
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeSelectorContext.Provider, {
1181
+ value: contextValue,
1182
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Root, {
1183
+ open: isOpen,
1184
+ onOpenChange: setIsOpen,
1185
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1186
+ "data-re-node-selector": "",
1187
+ ...isOpen ? { "data-open": "" } : {},
1188
+ className,
1189
+ children
1190
+ })
1191
+ })
1192
+ });
1193
+ }
1194
+ function NodeSelectorTrigger({ className, children }) {
1195
+ const { activeItem, isOpen, setIsOpen } = useNodeSelectorContext();
1196
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Trigger, {
1197
+ "data-re-node-selector-trigger": "",
1198
+ className,
1199
+ onClick: () => setIsOpen(!isOpen),
1200
+ 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)(ChevronDown, {})] })
1201
+ });
1202
+ }
1203
+ function NodeSelectorContent({ className, align = "start", children }) {
1204
+ const { items, setIsOpen } = useNodeSelectorContext();
1205
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_popover.Content, {
1206
+ align,
1207
+ "data-re-node-selector-content": "",
1208
+ className,
1209
+ children: children ? children(items, () => setIsOpen(false)) : items.map((item) => {
1210
+ const Icon = item.icon;
1211
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1212
+ type: "button",
1213
+ "data-re-node-selector-item": "",
1214
+ ...item.isActive ? { "data-active": "" } : {},
1215
+ onClick: () => {
1216
+ item.command();
1217
+ setIsOpen(false);
1218
+ },
1219
+ children: [
1220
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {}),
1221
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.name }),
1222
+ item.isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {})
1223
+ ]
1224
+ }, item.name);
1225
+ })
1226
+ });
1227
+ }
1228
+ function BubbleMenuNodeSelector({ omit = [], className, triggerContent, open, onOpenChange }) {
1229
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NodeSelectorRoot, {
1230
+ omit,
1231
+ open,
1232
+ onOpenChange,
1233
+ className,
1234
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeSelectorTrigger, { children: triggerContent }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeSelectorContent, {})]
1235
+ });
1236
+ }
1237
+
1238
+ //#endregion
1239
+ //#region src/ui/bubble-menu/root.tsx
1240
+ function BubbleMenuRoot({ excludeNodes = [], excludeMarks = [], placement = "bottom", offset: offset$1 = 8, onHide, className, children, ...rest }) {
1241
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
1242
+ if (!editor) return null;
1243
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
1244
+ editor,
1245
+ pluginKey: "textBubbleMenu",
1246
+ "data-re-bubble-menu": "",
1247
+ shouldShow: ({ editor: editor$1, view, state }) => {
1248
+ for (const node of excludeNodes) {
1249
+ if (editor$1.isActive(node)) return false;
1250
+ const { $from } = state.selection;
1251
+ for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === node) return false;
1252
+ }
1253
+ for (const mark of excludeMarks) if (editor$1.isActive(mark)) return false;
1254
+ if (view.dom.classList.contains("dragging")) return false;
1255
+ return editor$1.view.state.selection.content().size > 0;
1256
+ },
1257
+ options: {
1258
+ placement,
1259
+ offset: offset$1,
1260
+ onHide
1261
+ },
1262
+ className,
1263
+ ...rest,
1264
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuContext.Provider, {
1265
+ value: { editor },
1266
+ children
1267
+ })
1268
+ });
1269
+ }
1270
+
1271
+ //#endregion
1272
+ //#region src/ui/bubble-menu/strike.tsx
1273
+ const BubbleMenuStrike = createMarkBubbleItem({
1274
+ name: "strike",
1275
+ activeName: "strike",
1276
+ command: "toggleStrike",
1277
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StrikethroughIcon, {})
1278
+ });
1279
+
1280
+ //#endregion
1281
+ //#region src/ui/bubble-menu/underline.tsx
1282
+ const BubbleMenuUnderline = createMarkBubbleItem({
1283
+ name: "underline",
1284
+ activeName: "underline",
1285
+ command: "toggleUnderline",
1286
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnderlineIcon, {})
1287
+ });
1288
+
1289
+ //#endregion
1290
+ //#region src/ui/bubble-menu/uppercase.tsx
1291
+ const BubbleMenuUppercase = createMarkBubbleItem({
1292
+ name: "uppercase",
1293
+ activeName: "uppercase",
1294
+ command: "toggleUppercase",
1295
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CaseUpperIcon, {})
1296
+ });
1297
+
1298
+ //#endregion
1299
+ //#region src/ui/bubble-menu/default.tsx
1300
+ function BubbleMenuDefault({ excludeItems = [], excludeNodes, excludeMarks, placement, offset: offset$1, onHide, className, ...rest }) {
1301
+ const [isNodeSelectorOpen, setIsNodeSelectorOpen] = react.useState(false);
1302
+ const [isLinkSelectorOpen, setIsLinkSelectorOpen] = react.useState(false);
1303
+ const has = (item) => !excludeItems.includes(item);
1304
+ const handleNodeSelectorOpenChange = react.useCallback((open) => {
1305
+ setIsNodeSelectorOpen(open);
1306
+ if (open) setIsLinkSelectorOpen(false);
1307
+ }, []);
1308
+ const handleLinkSelectorOpenChange = react.useCallback((open) => {
1309
+ setIsLinkSelectorOpen(open);
1310
+ if (open) setIsNodeSelectorOpen(false);
1311
+ }, []);
1312
+ const handleHide = react.useCallback(() => {
1313
+ setIsNodeSelectorOpen(false);
1314
+ setIsLinkSelectorOpen(false);
1315
+ onHide?.();
1316
+ }, [onHide]);
1317
+ const hasFormattingItems = has("bold") || has("italic") || has("underline") || has("strike") || has("code") || has("uppercase");
1318
+ const hasAlignmentItems = has("align-left") || has("align-center") || has("align-right");
1319
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuRoot, {
1320
+ excludeNodes,
1321
+ excludeMarks,
1322
+ placement,
1323
+ offset: offset$1,
1324
+ onHide: handleHide,
1325
+ className,
1326
+ ...rest,
1327
+ children: [
1328
+ has("node-selector") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuNodeSelector, {
1329
+ open: isNodeSelectorOpen,
1330
+ onOpenChange: handleNodeSelectorOpenChange
1331
+ }),
1332
+ has("link-selector") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkSelector, {
1333
+ open: isLinkSelectorOpen,
1334
+ onOpenChange: handleLinkSelectorOpenChange
1335
+ }),
1336
+ hasFormattingItems && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuItemGroup, { children: [
1337
+ has("bold") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuBold, {}),
1338
+ has("italic") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItalic, {}),
1339
+ has("underline") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuUnderline, {}),
1340
+ has("strike") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuStrike, {}),
1341
+ has("code") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuCode, {}),
1342
+ has("uppercase") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuUppercase, {})
1343
+ ] }),
1344
+ hasAlignmentItems && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuItemGroup, { children: [
1345
+ has("align-left") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignLeft, {}),
1346
+ has("align-center") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignCenter, {}),
1347
+ has("align-right") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignRight, {})
1348
+ ] })
1349
+ ]
1350
+ });
1351
+ }
1352
+
1353
+ //#endregion
1354
+ //#region src/ui/button-bubble-menu/context.tsx
1355
+ const ButtonBubbleMenuContext = react.createContext(null);
1356
+ function useButtonBubbleMenuContext() {
1357
+ const context = react.useContext(ButtonBubbleMenuContext);
1358
+ if (!context) throw new Error("ButtonBubbleMenu compound components must be used within <ButtonBubbleMenu.Root>");
1359
+ return context;
1360
+ }
1361
+
1362
+ //#endregion
1363
+ //#region src/ui/button-bubble-menu/edit-link.tsx
1364
+ function ButtonBubbleMenuEditLink({ className, children, onClick, onMouseDown, ...rest }) {
1365
+ const { setIsEditing } = useButtonBubbleMenuContext();
1366
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1367
+ ...rest,
1368
+ type: "button",
1369
+ "aria-label": "Edit link",
1370
+ "data-re-btn-bm-item": "",
1371
+ "data-item": "edit-link",
1372
+ className,
1373
+ onMouseDown: (e) => {
1374
+ e.preventDefault();
1375
+ onMouseDown?.(e);
1376
+ },
1377
+ onClick: (e) => {
1378
+ onClick?.(e);
1379
+ setIsEditing(true);
1380
+ },
1381
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PencilIcon, {})
1382
+ });
1383
+ }
1384
+
1385
+ //#endregion
1386
+ //#region src/ui/button-bubble-menu/form.tsx
1387
+ function ButtonBubbleMenuForm({ className, validateUrl, onLinkApply, onLinkRemove }) {
1388
+ const { editor, buttonHref, isEditing, setIsEditing } = useButtonBubbleMenuContext();
1389
+ const inputRef = react.useRef(null);
1390
+ const formRef = react.useRef(null);
1391
+ const displayHref = buttonHref === "#" ? "" : buttonHref;
1392
+ const [inputValue, setInputValue] = react.useState(displayHref);
1393
+ react.useEffect(() => {
1394
+ if (!isEditing) return;
1395
+ setInputValue(displayHref);
1396
+ const timeoutId = setTimeout(() => {
1397
+ inputRef.current?.focus();
1398
+ }, 0);
1399
+ return () => clearTimeout(timeoutId);
1400
+ }, [isEditing, displayHref]);
1401
+ react.useEffect(() => {
1402
+ if (!isEditing) return;
1403
+ const handleKeyDown = (event) => {
1404
+ if (event.key === "Escape") setIsEditing(false);
1405
+ };
1406
+ const handleClickOutside = (event) => {
1407
+ if (formRef.current && !formRef.current.contains(event.target)) {
1408
+ const form = formRef.current;
1409
+ const submitEvent = new Event("submit", {
1410
+ bubbles: true,
1411
+ cancelable: true
1412
+ });
1413
+ form.dispatchEvent(submitEvent);
1414
+ setIsEditing(false);
1415
+ }
1416
+ };
1417
+ document.addEventListener("mousedown", handleClickOutside);
1418
+ window.addEventListener("keydown", handleKeyDown);
1419
+ return () => {
1420
+ window.removeEventListener("keydown", handleKeyDown);
1421
+ document.removeEventListener("mousedown", handleClickOutside);
1422
+ };
1423
+ }, [isEditing, setIsEditing]);
1424
+ if (!isEditing) return null;
1425
+ function handleSubmit(e) {
1426
+ e.preventDefault();
1427
+ const value = inputValue.trim();
1428
+ if (value === "") {
1429
+ editor.commands.updateButton({ href: "#" });
1430
+ setIsEditing(false);
1431
+ focusEditor(editor);
1432
+ onLinkRemove?.();
1433
+ return;
1434
+ }
1435
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1436
+ if (!finalValue) {
1437
+ editor.commands.updateButton({ href: "#" });
1438
+ setIsEditing(false);
1439
+ focusEditor(editor);
1440
+ onLinkRemove?.();
1441
+ return;
1442
+ }
1443
+ editor.commands.updateButton({ href: finalValue });
1444
+ setIsEditing(false);
1445
+ focusEditor(editor);
1446
+ onLinkApply?.(finalValue);
1447
+ }
1448
+ function handleUnlink(e) {
1449
+ e.stopPropagation();
1450
+ editor.commands.updateButton({ href: "#" });
1451
+ setIsEditing(false);
1452
+ focusEditor(editor);
1453
+ onLinkRemove?.();
1454
+ }
1455
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1456
+ ref: formRef,
1457
+ "data-re-btn-bm-form": "",
1458
+ className,
1459
+ onMouseDown: (e) => e.stopPropagation(),
1460
+ onClick: (e) => e.stopPropagation(),
1461
+ onKeyDown: (e) => e.stopPropagation(),
1462
+ onSubmit: handleSubmit,
1463
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1464
+ ref: inputRef,
1465
+ "data-re-btn-bm-input": "",
1466
+ value: inputValue,
1467
+ onFocus: (e) => e.stopPropagation(),
1468
+ onChange: (e) => setInputValue(e.target.value),
1469
+ placeholder: "Paste a link",
1470
+ type: "text"
1471
+ }), displayHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1472
+ type: "button",
1473
+ "aria-label": "Remove link",
1474
+ "data-re-btn-bm-unlink": "",
1475
+ onClick: handleUnlink,
1476
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1477
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1478
+ type: "submit",
1479
+ "aria-label": "Apply link",
1480
+ "data-re-btn-bm-apply": "",
1481
+ onMouseDown: (e) => e.stopPropagation(),
1482
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {})
1483
+ })]
1484
+ });
1485
+ }
1486
+
1487
+ //#endregion
1488
+ //#region src/ui/button-bubble-menu/root.tsx
1489
+ function ButtonBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8, className, children, ...rest }) {
1490
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
1491
+ const [isEditing, setIsEditing] = react.useState(false);
1492
+ const buttonHref = (0, _tiptap_react.useEditorState)({
1493
+ editor,
1494
+ selector: ({ editor: e }) => e?.getAttributes("button").href ?? ""
1495
+ });
1496
+ if (!editor) return null;
1497
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
1498
+ editor,
1499
+ pluginKey: "buttonBubbleMenu",
1500
+ "data-re-btn-bm": "",
1501
+ shouldShow: ({ editor: e, view }) => e.isActive("button") && !view.dom.classList.contains("dragging"),
1502
+ options: {
1503
+ placement,
1504
+ offset: offset$1,
1505
+ onHide: () => {
1506
+ setIsEditing(false);
1507
+ onHide?.();
1508
+ }
1509
+ },
1510
+ className,
1511
+ ...rest,
1512
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuContext.Provider, {
1513
+ value: {
1514
+ editor,
1515
+ buttonHref: buttonHref ?? "",
1516
+ isEditing,
1517
+ setIsEditing
1518
+ },
1519
+ children
1520
+ })
1521
+ });
1522
+ }
1523
+
1524
+ //#endregion
1525
+ //#region src/ui/button-bubble-menu/toolbar.tsx
1526
+ function ButtonBubbleMenuToolbar({ children, ...rest }) {
1527
+ const { isEditing } = useButtonBubbleMenuContext();
1528
+ if (isEditing) return null;
1529
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1530
+ "data-re-btn-bm-toolbar": "",
1531
+ ...rest,
1532
+ children
1533
+ });
1534
+ }
1535
+
1536
+ //#endregion
1537
+ //#region src/ui/button-bubble-menu/unlink.tsx
1538
+ function ButtonBubbleMenuUnlink({ className, children, onClick, onMouseDown, onLinkRemove, ...rest }) {
1539
+ const { editor } = useButtonBubbleMenuContext();
1540
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1541
+ ...rest,
1542
+ type: "button",
1543
+ "aria-label": "Remove link",
1544
+ "data-re-btn-bm-item": "",
1545
+ "data-item": "unlink",
1546
+ className,
1547
+ onMouseDown: (e) => {
1548
+ e.preventDefault();
1549
+ onMouseDown?.(e);
1550
+ },
1551
+ onClick: (e) => {
1552
+ onClick?.(e);
1553
+ editor.commands.updateButton({ href: "#" });
1554
+ focusEditor(editor);
1555
+ onLinkRemove?.();
1556
+ },
1557
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1558
+ });
1559
+ }
1560
+
1561
+ //#endregion
1562
+ //#region src/ui/button-bubble-menu/default.tsx
1563
+ function ButtonBubbleMenuDefaultInner({ validateUrl, onLinkApply, onLinkRemove }) {
1564
+ const { buttonHref } = useButtonBubbleMenuContext();
1565
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ButtonBubbleMenuToolbar, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuEditLink, {}), buttonHref !== "" && buttonHref !== "#" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuUnlink, { onLinkRemove })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuForm, {
1566
+ validateUrl,
1567
+ onLinkApply,
1568
+ onLinkRemove
1569
+ })] });
1570
+ }
1571
+ function ButtonBubbleMenuDefault({ placement, offset: offset$1, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
1572
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuRoot, {
1573
+ placement,
1574
+ offset: offset$1,
1575
+ onHide,
1576
+ className,
1577
+ ...rest,
1578
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuDefaultInner, {
1579
+ validateUrl,
1580
+ onLinkApply,
1581
+ onLinkRemove
1582
+ })
1583
+ });
1584
+ }
1585
+
1586
+ //#endregion
1587
+ //#region src/ui/image-bubble-menu/context.tsx
1588
+ const ImageBubbleMenuContext = react.createContext(null);
1589
+ function useImageBubbleMenuContext() {
1590
+ const context = react.useContext(ImageBubbleMenuContext);
1591
+ if (!context) throw new Error("ImageBubbleMenu compound components must be used within <ImageBubbleMenu.Root>");
1592
+ return context;
1593
+ }
1594
+
1595
+ //#endregion
1596
+ //#region src/ui/image-bubble-menu/edit-link.tsx
1597
+ function ImageBubbleMenuEditLink({ className, children, onClick, onMouseDown, ...rest }) {
1598
+ const { setIsEditing } = useImageBubbleMenuContext();
1599
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1600
+ ...rest,
1601
+ type: "button",
1602
+ "aria-label": "Edit link",
1603
+ "data-re-img-bm-item": "",
1604
+ "data-item": "edit-link",
1605
+ className,
1606
+ onMouseDown: (e) => {
1607
+ e.preventDefault();
1608
+ onMouseDown?.(e);
1609
+ },
1610
+ onClick: (e) => {
1611
+ onClick?.(e);
1612
+ setIsEditing(true);
1613
+ },
1614
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkIcon, {})
1615
+ });
1616
+ }
1617
+
1618
+ //#endregion
1619
+ //#region src/ui/image-bubble-menu/root.tsx
1620
+ function ImageBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8, className, children, ...rest }) {
1621
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
1622
+ const [isEditing, setIsEditing] = react.useState(false);
1623
+ if (!editor) return null;
1624
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
1625
+ editor,
1626
+ pluginKey: "imageBubbleMenu",
1627
+ "data-re-img-bm": "",
1628
+ shouldShow: ({ editor: e, view }) => e.isActive("image") && !view.dom.classList.contains("dragging"),
1629
+ options: {
1630
+ placement,
1631
+ offset: offset$1,
1632
+ onHide: () => {
1633
+ setIsEditing(false);
1634
+ onHide?.();
1635
+ }
1636
+ },
1637
+ className,
1638
+ ...rest,
1639
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageBubbleMenuContext.Provider, {
1640
+ value: {
1641
+ editor,
1642
+ isEditing,
1643
+ setIsEditing
1644
+ },
1645
+ children
1646
+ })
1647
+ });
1648
+ }
1649
+
1650
+ //#endregion
1651
+ //#region src/ui/image-bubble-menu/toolbar.tsx
1652
+ function ImageBubbleMenuToolbar({ children, ...rest }) {
1653
+ const { isEditing } = useImageBubbleMenuContext();
1654
+ if (isEditing) return null;
1655
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1656
+ "data-re-img-bm-toolbar": "",
1657
+ ...rest,
1658
+ children
1659
+ });
1660
+ }
1661
+
1662
+ //#endregion
1663
+ //#region src/ui/image-bubble-menu/default.tsx
1664
+ function ImageBubbleMenuDefault({ excludeItems = [], placement, offset: offset$1, onHide, className, ...rest }) {
1665
+ const hasEditLink = !excludeItems.includes("edit-link");
1666
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageBubbleMenuRoot, {
1667
+ placement,
1668
+ offset: offset$1,
1669
+ onHide,
1670
+ className,
1671
+ ...rest,
1672
+ children: hasEditLink && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageBubbleMenuToolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageBubbleMenuEditLink, {}) })
1673
+ });
1674
+ }
1675
+
1676
+ //#endregion
1677
+ //#region src/ui/link-bubble-menu/context.tsx
1678
+ const LinkBubbleMenuContext = react.createContext(null);
1679
+ function useLinkBubbleMenuContext() {
1680
+ const context = react.useContext(LinkBubbleMenuContext);
1681
+ if (!context) throw new Error("LinkBubbleMenu compound components must be used within <LinkBubbleMenu.Root>");
1682
+ return context;
1683
+ }
1684
+
1685
+ //#endregion
1686
+ //#region src/ui/link-bubble-menu/edit-link.tsx
1687
+ function LinkBubbleMenuEditLink({ className, children, onClick, onMouseDown, ...rest }) {
1688
+ const { setIsEditing } = useLinkBubbleMenuContext();
1689
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1690
+ type: "button",
1691
+ "aria-label": "Edit link",
1692
+ "data-re-link-bm-item": "",
1693
+ "data-item": "edit-link",
1694
+ className,
1695
+ onMouseDown: (e) => {
1696
+ e.preventDefault();
1697
+ onMouseDown?.(e);
1698
+ },
1699
+ onClick: (e) => {
1700
+ onClick?.(e);
1701
+ setIsEditing(true);
1702
+ },
1703
+ ...rest,
1704
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PencilIcon, {})
1705
+ });
1706
+ }
1707
+
1708
+ //#endregion
1709
+ //#region src/ui/link-bubble-menu/form.tsx
1710
+ function LinkBubbleMenuForm({ className, validateUrl, onLinkApply, onLinkRemove, children }) {
1711
+ const { editor, linkHref, isEditing, setIsEditing } = useLinkBubbleMenuContext();
1712
+ const inputRef = react.useRef(null);
1713
+ const formRef = react.useRef(null);
1714
+ const displayHref = linkHref === "#" ? "" : linkHref;
1715
+ const [inputValue, setInputValue] = react.useState(displayHref);
1716
+ react.useEffect(() => {
1717
+ if (!isEditing) return;
1718
+ setInputValue(displayHref);
1719
+ const timeoutId = setTimeout(() => {
1720
+ inputRef.current?.focus();
1721
+ }, 0);
1722
+ return () => clearTimeout(timeoutId);
1723
+ }, [isEditing, displayHref]);
1724
+ react.useEffect(() => {
1725
+ if (!isEditing) return;
1726
+ const handleKeyDown = (event) => {
1727
+ if (event.key === "Escape") setIsEditing(false);
1728
+ };
1729
+ const handleClickOutside = (event) => {
1730
+ if (formRef.current && !formRef.current.contains(event.target)) {
1731
+ const form = formRef.current;
1732
+ const submitEvent = new Event("submit", {
1733
+ bubbles: true,
1734
+ cancelable: true
1735
+ });
1736
+ form.dispatchEvent(submitEvent);
1737
+ setIsEditing(false);
1738
+ }
1739
+ };
1740
+ document.addEventListener("mousedown", handleClickOutside);
1741
+ window.addEventListener("keydown", handleKeyDown);
1742
+ return () => {
1743
+ window.removeEventListener("keydown", handleKeyDown);
1744
+ document.removeEventListener("mousedown", handleClickOutside);
1745
+ };
1746
+ }, [isEditing, setIsEditing]);
1747
+ if (!isEditing) return null;
1748
+ function handleSubmit(e) {
1749
+ e.preventDefault();
1750
+ const value = inputValue.trim();
1751
+ if (value === "") {
1752
+ setLinkHref(editor, "");
1753
+ setIsEditing(false);
1754
+ focusEditor(editor);
1755
+ onLinkRemove?.();
1756
+ return;
1757
+ }
1758
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1759
+ if (!finalValue) {
1760
+ setLinkHref(editor, "");
1761
+ setIsEditing(false);
1762
+ focusEditor(editor);
1763
+ onLinkRemove?.();
1764
+ return;
1765
+ }
1766
+ setLinkHref(editor, finalValue);
1767
+ setIsEditing(false);
1768
+ focusEditor(editor);
1769
+ onLinkApply?.(finalValue);
1770
+ }
1771
+ function handleUnlink(e) {
1772
+ e.stopPropagation();
1773
+ setLinkHref(editor, "");
1774
+ setIsEditing(false);
1775
+ focusEditor(editor);
1776
+ onLinkRemove?.();
1777
+ }
1778
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1779
+ ref: formRef,
1780
+ "data-re-link-bm-form": "",
1781
+ className,
1782
+ onMouseDown: (e) => e.stopPropagation(),
1783
+ onClick: (e) => e.stopPropagation(),
1784
+ onKeyDown: (e) => e.stopPropagation(),
1785
+ onSubmit: handleSubmit,
1786
+ children: [
1787
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1788
+ ref: inputRef,
1789
+ "data-re-link-bm-input": "",
1790
+ value: inputValue,
1791
+ onFocus: (e) => e.stopPropagation(),
1792
+ onChange: (e) => setInputValue(e.target.value),
1793
+ placeholder: "Paste a link",
1794
+ type: "text"
1795
+ }),
1796
+ children,
1797
+ displayHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1798
+ type: "button",
1799
+ "aria-label": "Remove link",
1800
+ "data-re-link-bm-unlink": "",
1801
+ onClick: handleUnlink,
1802
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1803
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1804
+ type: "submit",
1805
+ "aria-label": "Apply link",
1806
+ "data-re-link-bm-apply": "",
1807
+ onMouseDown: (e) => e.stopPropagation(),
1808
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Check, {})
1809
+ })
1810
+ ]
1811
+ });
1812
+ }
1813
+
1814
+ //#endregion
1815
+ //#region src/ui/link-bubble-menu/open-link.tsx
1816
+ function LinkBubbleMenuOpenLink({ className, children, ...rest }) {
1817
+ const { linkHref } = useLinkBubbleMenuContext();
1818
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1819
+ ...rest,
1820
+ href: linkHref,
1821
+ target: "_blank",
1822
+ rel: "noopener noreferrer",
1823
+ "aria-label": "Open link",
1824
+ "data-re-link-bm-item": "",
1825
+ "data-item": "open-link",
1826
+ className,
1827
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExternalLinkIcon, {})
1828
+ });
1829
+ }
1830
+
1831
+ //#endregion
1832
+ //#region src/ui/link-bubble-menu/root.tsx
1833
+ function LinkBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8, className, children, ...rest }) {
1834
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
1835
+ const [isEditing, setIsEditing] = react.useState(false);
1836
+ const linkHref = (0, _tiptap_react.useEditorState)({
1837
+ editor,
1838
+ selector: ({ editor: e }) => e?.getAttributes("link").href ?? ""
1839
+ });
1840
+ if (!editor) return null;
1841
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
1842
+ editor,
1843
+ pluginKey: "linkBubbleMenu",
1844
+ "data-re-link-bm": "",
1845
+ shouldShow: ({ editor: e }) => e.isActive("link") && e.view.state.selection.content().size === 0,
1846
+ options: {
1847
+ placement,
1848
+ offset: offset$1,
1849
+ onHide: () => {
1850
+ setIsEditing(false);
1851
+ onHide?.();
1852
+ }
1853
+ },
1854
+ className,
1855
+ ...rest,
1856
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkBubbleMenuContext.Provider, {
1857
+ value: {
1858
+ editor,
1859
+ linkHref: linkHref ?? "",
1860
+ isEditing,
1861
+ setIsEditing
1862
+ },
1863
+ children
1864
+ })
1865
+ });
1866
+ }
1867
+
1868
+ //#endregion
1869
+ //#region src/ui/link-bubble-menu/toolbar.tsx
1870
+ function LinkBubbleMenuToolbar({ children, ...rest }) {
1871
+ const { isEditing } = useLinkBubbleMenuContext();
1872
+ if (isEditing) return null;
1873
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1874
+ "data-re-link-bm-toolbar": "",
1875
+ ...rest,
1876
+ children
1877
+ });
1878
+ }
1879
+
1880
+ //#endregion
1881
+ //#region src/ui/link-bubble-menu/unlink.tsx
1882
+ function LinkBubbleMenuUnlink({ className, children, onClick, onMouseDown, ...rest }) {
1883
+ const { editor } = useLinkBubbleMenuContext();
1884
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1885
+ type: "button",
1886
+ "aria-label": "Remove link",
1887
+ "data-re-link-bm-item": "",
1888
+ "data-item": "unlink",
1889
+ className,
1890
+ onMouseDown: (e) => {
1891
+ e.preventDefault();
1892
+ onMouseDown?.(e);
1893
+ },
1894
+ onClick: (e) => {
1895
+ onClick?.(e);
1896
+ editor.chain().focus().unsetLink().run();
1897
+ },
1898
+ ...rest,
1899
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1900
+ });
1901
+ }
1902
+
1903
+ //#endregion
1904
+ //#region src/ui/link-bubble-menu/default.tsx
1905
+ function LinkBubbleMenuDefault({ excludeItems = [], placement, offset: offset$1, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
1906
+ const has = (item) => !excludeItems.includes(item);
1907
+ const hasToolbarItems = has("edit-link") || has("open-link") || has("unlink");
1908
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LinkBubbleMenuRoot, {
1909
+ placement,
1910
+ offset: offset$1,
1911
+ onHide,
1912
+ className,
1913
+ ...rest,
1914
+ children: [hasToolbarItems && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LinkBubbleMenuToolbar, { children: [
1915
+ has("edit-link") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkBubbleMenuEditLink, {}),
1916
+ has("open-link") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkBubbleMenuOpenLink, {}),
1917
+ has("unlink") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkBubbleMenuUnlink, {})
1918
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkBubbleMenuForm, {
1919
+ validateUrl,
1920
+ onLinkApply,
1921
+ onLinkRemove
1922
+ })]
1923
+ });
1924
+ }
1925
+
1926
+ //#endregion
1927
+ //#region src/ui/slash-command/utils.ts
1928
+ function isInsideNode(editor, type) {
1929
+ const { $from } = editor.state.selection;
1930
+ for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === type) return true;
1931
+ return false;
1932
+ }
1933
+ function isAtMaxColumnsDepth(editor) {
1934
+ const { from } = editor.state.selection;
1935
+ return require_event_bus.getColumnsDepth(editor.state.doc, from) >= require_event_bus.MAX_COLUMNS_DEPTH;
1936
+ }
1937
+ function updateScrollView(container, item) {
1938
+ const containerRect = container.getBoundingClientRect();
1939
+ const itemRect = item.getBoundingClientRect();
1940
+ if (itemRect.top < containerRect.top) container.scrollTop -= containerRect.top - itemRect.top;
1941
+ else if (itemRect.bottom > containerRect.bottom) container.scrollTop += itemRect.bottom - containerRect.bottom;
1942
+ }
1943
+
1944
+ //#endregion
1945
+ //#region src/ui/slash-command/command-list.tsx
1946
+ const CATEGORY_ORDER = [
1947
+ "Text",
1948
+ "Media",
1949
+ "Layout",
1950
+ "Utility"
1951
+ ];
1952
+ function groupByCategory(items) {
1953
+ const seen = /* @__PURE__ */ new Map();
1954
+ for (const item of items) {
1955
+ const existing = seen.get(item.category);
1956
+ if (existing) existing.push(item);
1957
+ else seen.set(item.category, [item]);
1958
+ }
1959
+ const ordered = [];
1960
+ for (const cat of CATEGORY_ORDER) {
1961
+ const group = seen.get(cat);
1962
+ if (group) {
1963
+ ordered.push({
1964
+ category: cat,
1965
+ items: group
1966
+ });
1967
+ seen.delete(cat);
1968
+ }
1969
+ }
1970
+ for (const [category, group] of seen) ordered.push({
1971
+ category,
1972
+ items: group
1973
+ });
1974
+ return ordered;
1975
+ }
1976
+ function CommandItem({ item, selected, onSelect }) {
1977
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1978
+ "data-re-slash-command-item": "",
1979
+ "data-selected": selected || void 0,
1980
+ onClick: onSelect,
1981
+ type: "button",
1982
+ children: [item.icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.title })]
1983
+ });
1984
+ }
1985
+ function CommandList({ items, query, selectedIndex, onSelect }) {
1986
+ const containerRef = (0, react.useRef)(null);
1987
+ (0, react.useLayoutEffect)(() => {
1988
+ const container = containerRef.current;
1989
+ if (!container) return;
1990
+ const selected = container.querySelector("[data-selected]");
1991
+ if (selected) updateScrollView(container, selected);
1992
+ }, [selectedIndex]);
1993
+ if (items.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1994
+ "data-re-slash-command": "",
1995
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1996
+ "data-re-slash-command-empty": "",
1997
+ children: "No results"
1998
+ })
1999
+ });
2000
+ if (query.trim().length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2001
+ "data-re-slash-command": "",
2002
+ ref: containerRef,
2003
+ children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
2004
+ item,
2005
+ onSelect: () => onSelect(index),
2006
+ selected: index === selectedIndex
2007
+ }, item.title))
2008
+ });
2009
+ const groups = groupByCategory(items);
2010
+ let flatIndex = 0;
2011
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2012
+ "data-re-slash-command": "",
2013
+ ref: containerRef,
2014
+ children: groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2015
+ "data-re-slash-command-category": "",
2016
+ children: group.category
2017
+ }), group.items.map((item) => {
2018
+ const currentIndex = flatIndex++;
2019
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
2020
+ item,
2021
+ onSelect: () => onSelect(currentIndex),
2022
+ selected: currentIndex === selectedIndex
2023
+ }, item.title);
2024
+ })] }, group.category))
2025
+ });
2026
+ }
2027
+
2028
+ //#endregion
2029
+ //#region src/ui/slash-command/commands.tsx
2030
+ const TEXT = {
2031
+ title: "Text",
2032
+ description: "Plain text block",
2033
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, { size: 20 }),
2034
+ category: "Text",
2035
+ searchTerms: ["p", "paragraph"],
2036
+ command: ({ editor, range }) => {
2037
+ editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
2038
+ }
2039
+ };
2040
+ const H1 = {
2041
+ title: "Title",
2042
+ description: "Large heading",
2043
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading1, { size: 20 }),
2044
+ category: "Text",
2045
+ searchTerms: [
2046
+ "title",
2047
+ "big",
2048
+ "large",
2049
+ "h1"
2050
+ ],
2051
+ command: ({ editor, range }) => {
2052
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
2053
+ }
2054
+ };
2055
+ const H2 = {
2056
+ title: "Subtitle",
2057
+ description: "Medium heading",
2058
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading2, { size: 20 }),
2059
+ category: "Text",
2060
+ searchTerms: [
2061
+ "subtitle",
2062
+ "medium",
2063
+ "h2"
2064
+ ],
2065
+ command: ({ editor, range }) => {
2066
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
2067
+ }
2068
+ };
2069
+ const H3 = {
2070
+ title: "Heading",
2071
+ description: "Small heading",
2072
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading3, { size: 20 }),
2073
+ category: "Text",
2074
+ searchTerms: [
2075
+ "subtitle",
2076
+ "small",
2077
+ "h3"
2078
+ ],
2079
+ command: ({ editor, range }) => {
2080
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
2081
+ }
2082
+ };
2083
+ const BULLET_LIST = {
2084
+ title: "Bullet list",
2085
+ description: "Unordered list",
2086
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(List, { size: 20 }),
2087
+ category: "Text",
2088
+ searchTerms: ["unordered", "point"],
2089
+ command: ({ editor, range }) => {
2090
+ editor.chain().focus().deleteRange(range).toggleBulletList().run();
2091
+ }
2092
+ };
2093
+ const NUMBERED_LIST = {
2094
+ title: "Numbered list",
2095
+ description: "Ordered list",
2096
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListOrdered, { size: 20 }),
2097
+ category: "Text",
2098
+ searchTerms: ["ordered"],
2099
+ command: ({ editor, range }) => {
2100
+ editor.chain().focus().deleteRange(range).toggleOrderedList().run();
2101
+ }
2102
+ };
2103
+ const QUOTE = {
2104
+ title: "Quote",
2105
+ description: "Block quote",
2106
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextQuote, { size: 20 }),
2107
+ category: "Text",
2108
+ searchTerms: ["blockquote"],
2109
+ command: ({ editor, range }) => {
2110
+ editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").toggleBlockquote().run();
2111
+ }
2112
+ };
2113
+ const CODE = {
2114
+ title: "Code block",
2115
+ description: "Code snippet",
2116
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareCode, { size: 20 }),
2117
+ category: "Text",
2118
+ searchTerms: ["codeblock"],
2119
+ command: ({ editor, range }) => {
2120
+ editor.chain().focus().deleteRange(range).toggleCodeBlock().run();
2121
+ }
2122
+ };
2123
+ const BUTTON = {
2124
+ title: "Button",
2125
+ description: "Clickable button",
2126
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MousePointer, { size: 20 }),
2127
+ category: "Layout",
2128
+ searchTerms: ["button"],
2129
+ command: ({ editor, range }) => {
2130
+ editor.chain().focus().deleteRange(range).setButton().run();
2131
+ }
2132
+ };
2133
+ const DIVIDER = {
2134
+ title: "Divider",
2135
+ description: "Horizontal separator",
2136
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitSquareVertical, { size: 20 }),
2137
+ category: "Layout",
2138
+ searchTerms: [
2139
+ "hr",
2140
+ "divider",
2141
+ "separator"
2142
+ ],
2143
+ command: ({ editor, range }) => {
2144
+ editor.chain().focus().deleteRange(range).setHorizontalRule().run();
2145
+ }
2146
+ };
2147
+ const SECTION = {
2148
+ title: "Section",
2149
+ description: "Content section",
2150
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Rows2, { size: 20 }),
2151
+ category: "Layout",
2152
+ searchTerms: [
2153
+ "section",
2154
+ "row",
2155
+ "container"
2156
+ ],
2157
+ command: ({ editor, range }) => {
2158
+ editor.chain().focus().deleteRange(range).insertSection().run();
2159
+ }
2160
+ };
2161
+ const TWO_COLUMNS = {
2162
+ title: "2 columns",
2163
+ description: "Two column layout",
2164
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Columns2, { size: 20 }),
2165
+ category: "Layout",
2166
+ searchTerms: [
2167
+ "columns",
2168
+ "column",
2169
+ "layout",
2170
+ "grid",
2171
+ "split",
2172
+ "side-by-side",
2173
+ "multi-column",
2174
+ "row",
2175
+ "two",
2176
+ "2"
2177
+ ],
2178
+ command: ({ editor, range }) => {
2179
+ editor.chain().focus().deleteRange(range).insertColumns(2).run();
2180
+ }
2181
+ };
2182
+ const THREE_COLUMNS = {
2183
+ title: "3 columns",
2184
+ description: "Three column layout",
2185
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Columns3, { size: 20 }),
2186
+ category: "Layout",
2187
+ searchTerms: [
2188
+ "columns",
2189
+ "column",
2190
+ "layout",
2191
+ "grid",
2192
+ "split",
2193
+ "multi-column",
2194
+ "row",
2195
+ "three",
2196
+ "3"
2197
+ ],
2198
+ command: ({ editor, range }) => {
2199
+ editor.chain().focus().deleteRange(range).insertColumns(3).run();
2200
+ }
2201
+ };
2202
+ const FOUR_COLUMNS = {
2203
+ title: "4 columns",
2204
+ description: "Four column layout",
2205
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Columns4, { size: 20 }),
2206
+ category: "Layout",
2207
+ searchTerms: [
2208
+ "columns",
2209
+ "column",
2210
+ "layout",
2211
+ "grid",
2212
+ "split",
2213
+ "multi-column",
2214
+ "row",
2215
+ "four",
2216
+ "4"
2217
+ ],
2218
+ command: ({ editor, range }) => {
2219
+ editor.chain().focus().deleteRange(range).insertColumns(4).run();
2220
+ }
2221
+ };
2222
+ const defaultSlashCommands = [
2223
+ TEXT,
2224
+ H1,
2225
+ H2,
2226
+ H3,
2227
+ BULLET_LIST,
2228
+ NUMBERED_LIST,
2229
+ QUOTE,
2230
+ CODE,
2231
+ BUTTON,
2232
+ DIVIDER,
2233
+ SECTION,
2234
+ TWO_COLUMNS,
2235
+ THREE_COLUMNS,
2236
+ FOUR_COLUMNS
2237
+ ];
2238
+
2239
+ //#endregion
2240
+ //#region src/ui/slash-command/search.ts
2241
+ function scoreItem(item, query) {
2242
+ if (!query) return 100;
2243
+ const q = query.toLowerCase();
2244
+ const title = item.title.toLowerCase();
2245
+ const description = item.description.toLowerCase();
2246
+ const terms = item.searchTerms?.map((t) => t.toLowerCase()) ?? [];
2247
+ if (title === q) return 100;
2248
+ if (title.startsWith(q)) return 90;
2249
+ if (title.split(/\s+/).some((w) => w.startsWith(q))) return 80;
2250
+ if (terms.some((t) => t === q)) return 70;
2251
+ if (terms.some((t) => t.startsWith(q))) return 60;
2252
+ if (title.includes(q)) return 40;
2253
+ if (terms.some((t) => t.includes(q))) return 30;
2254
+ if (description.includes(q)) return 20;
2255
+ return 0;
2256
+ }
2257
+ function filterAndRankItems(items, query) {
2258
+ const trimmed = query.trim();
2259
+ if (!trimmed) return items;
2260
+ const scored = items.map((item) => ({
2261
+ item,
2262
+ score: scoreItem(item, trimmed)
2263
+ })).filter(({ score }) => score > 0);
2264
+ scored.sort((a, b) => b.score - a.score);
2265
+ return scored.map(({ item }) => item);
2266
+ }
2267
+
2268
+ //#endregion
2269
+ //#region src/ui/slash-command/root.tsx
2270
+ const pluginKey = new _tiptap_pm_state.PluginKey("slash-command");
2271
+ const INITIAL_STATE = {
2272
+ active: false,
2273
+ query: "",
2274
+ items: [],
2275
+ clientRect: null
2276
+ };
2277
+ function defaultFilterItems(items, query, editor) {
2278
+ return filterAndRankItems(isAtMaxColumnsDepth(editor) ? items.filter((item) => item.category !== "Layout" || !item.title.includes("column")) : items, query);
2279
+ }
2280
+ function SlashCommandRoot({ items: itemsProp, filterItems: filterItemsProp, char = "/", allow: allowProp, children }) {
2281
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
2282
+ const [state, setState] = (0, react.useState)(INITIAL_STATE);
2283
+ const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
2284
+ const itemsRef = (0, react.useRef)(itemsProp ?? defaultSlashCommands);
2285
+ const filterRef = (0, react.useRef)(filterItemsProp ?? defaultFilterItems);
2286
+ const allowRef = (0, react.useRef)(allowProp ?? (({ editor: e }) => !e.isActive("codeBlock")));
2287
+ itemsRef.current = itemsProp ?? defaultSlashCommands;
2288
+ filterRef.current = filterItemsProp ?? defaultFilterItems;
2289
+ allowRef.current = allowProp ?? (({ editor: e }) => !e.isActive("codeBlock"));
2290
+ const commandRef = (0, react.useRef)(null);
2291
+ const suggestionItemsRef = (0, react.useRef)([]);
2292
+ const selectedIndexRef = (0, react.useRef)(0);
2293
+ suggestionItemsRef.current = state.items;
2294
+ selectedIndexRef.current = selectedIndex;
2295
+ const { refs, floatingStyles } = (0, _floating_ui_react_dom.useFloating)({
2296
+ open: state.active,
2297
+ placement: "bottom-start",
2298
+ middleware: [
2299
+ (0, _floating_ui_react_dom.offset)(8),
2300
+ (0, _floating_ui_react_dom.flip)(),
2301
+ (0, _floating_ui_react_dom.shift)({ padding: 8 })
2302
+ ],
2303
+ whileElementsMounted: _floating_ui_react_dom.autoUpdate
2304
+ });
2305
+ (0, react.useEffect)(() => {
2306
+ if (!state.clientRect) return;
2307
+ refs.setReference({ getBoundingClientRect: state.clientRect });
2308
+ }, [state.clientRect, refs]);
2309
+ (0, react.useEffect)(() => {
2310
+ setSelectedIndex(0);
2311
+ }, [state.items]);
2312
+ const onSelect = (0, react.useCallback)((index) => {
2313
+ const item = suggestionItemsRef.current[index];
2314
+ if (item && commandRef.current) commandRef.current(item);
2315
+ }, []);
2316
+ (0, react.useEffect)(() => {
2317
+ if (!editor) return;
2318
+ const plugin = (0, _tiptap_suggestion.default)({
2319
+ pluginKey,
2320
+ editor,
2321
+ char,
2322
+ allow: ({ editor: e }) => allowRef.current({ editor: e }),
2323
+ command: ({ editor: e, range, props }) => {
2324
+ props.command({
2325
+ editor: e,
2326
+ range
2327
+ });
2328
+ },
2329
+ items: ({ query, editor: e }) => filterRef.current(itemsRef.current, query, e),
2330
+ render: () => ({
2331
+ onStart: (props) => {
2332
+ commandRef.current = props.command;
2333
+ setState({
2334
+ active: true,
2335
+ query: props.query,
2336
+ items: props.items,
2337
+ clientRect: props.clientRect ?? null
2338
+ });
2339
+ },
2340
+ onUpdate: (props) => {
2341
+ commandRef.current = props.command;
2342
+ setState({
2343
+ active: true,
2344
+ query: props.query,
2345
+ items: props.items,
2346
+ clientRect: props.clientRect ?? null
2347
+ });
2348
+ },
2349
+ onKeyDown: ({ event }) => {
2350
+ if (event.key === "Escape") {
2351
+ setState(INITIAL_STATE);
2352
+ return true;
2353
+ }
2354
+ const items = suggestionItemsRef.current;
2355
+ if (items.length === 0) return false;
2356
+ if (event.key === "ArrowUp") {
2357
+ setSelectedIndex((i) => (i + items.length - 1) % items.length);
2358
+ return true;
2359
+ }
2360
+ if (event.key === "ArrowDown") {
2361
+ setSelectedIndex((i) => (i + 1) % items.length);
2362
+ return true;
2363
+ }
2364
+ if (event.key === "Enter") {
2365
+ const item = items[selectedIndexRef.current];
2366
+ if (item && commandRef.current) commandRef.current(item);
2367
+ return true;
2368
+ }
2369
+ return false;
2370
+ },
2371
+ onExit: () => {
2372
+ setState(INITIAL_STATE);
2373
+ requestAnimationFrame(() => {
2374
+ commandRef.current = null;
2375
+ });
2376
+ }
2377
+ })
2378
+ });
2379
+ editor.registerPlugin(plugin, (newPlugin, plugins) => [newPlugin, ...plugins]);
2380
+ return () => {
2381
+ editor.unregisterPlugin(pluginKey);
2382
+ };
2383
+ }, [editor, char]);
2384
+ if (!editor || !state.active) return null;
2385
+ const renderProps = {
2386
+ items: state.items,
2387
+ query: state.query,
2388
+ selectedIndex,
2389
+ onSelect
2390
+ };
2391
+ let content;
2392
+ if (children) content = children(renderProps);
2393
+ else content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandList, { ...renderProps });
2394
+ return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2395
+ ref: refs.setFloating,
2396
+ style: floatingStyles,
2397
+ children: content
2398
+ }), document.body);
2399
+ }
2400
+
2401
+ //#endregion
2402
+ Object.defineProperty(exports, 'AlignCenterIcon', {
2403
+ enumerable: true,
2404
+ get: function () {
2405
+ return AlignCenterIcon;
2406
+ }
2407
+ });
2408
+ Object.defineProperty(exports, 'AlignLeftIcon', {
2409
+ enumerable: true,
2410
+ get: function () {
2411
+ return AlignLeftIcon;
2412
+ }
2413
+ });
2414
+ Object.defineProperty(exports, 'AlignRightIcon', {
2415
+ enumerable: true,
2416
+ get: function () {
2417
+ return AlignRightIcon;
2418
+ }
2419
+ });
2420
+ Object.defineProperty(exports, 'BULLET_LIST', {
2421
+ enumerable: true,
2422
+ get: function () {
2423
+ return BULLET_LIST;
2424
+ }
2425
+ });
2426
+ Object.defineProperty(exports, 'BUTTON', {
2427
+ enumerable: true,
2428
+ get: function () {
2429
+ return BUTTON;
2430
+ }
2431
+ });
2432
+ Object.defineProperty(exports, 'BoldIcon', {
2433
+ enumerable: true,
2434
+ get: function () {
2435
+ return BoldIcon;
2436
+ }
2437
+ });
2438
+ Object.defineProperty(exports, 'BubbleMenuAlignCenter', {
2439
+ enumerable: true,
2440
+ get: function () {
2441
+ return BubbleMenuAlignCenter;
2442
+ }
2443
+ });
2444
+ Object.defineProperty(exports, 'BubbleMenuAlignLeft', {
2445
+ enumerable: true,
2446
+ get: function () {
2447
+ return BubbleMenuAlignLeft;
2448
+ }
2449
+ });
2450
+ Object.defineProperty(exports, 'BubbleMenuAlignRight', {
2451
+ enumerable: true,
2452
+ get: function () {
2453
+ return BubbleMenuAlignRight;
2454
+ }
2455
+ });
2456
+ Object.defineProperty(exports, 'BubbleMenuBold', {
2457
+ enumerable: true,
2458
+ get: function () {
2459
+ return BubbleMenuBold;
2460
+ }
2461
+ });
2462
+ Object.defineProperty(exports, 'BubbleMenuCode', {
2463
+ enumerable: true,
2464
+ get: function () {
2465
+ return BubbleMenuCode;
2466
+ }
2467
+ });
2468
+ Object.defineProperty(exports, 'BubbleMenuDefault', {
2469
+ enumerable: true,
2470
+ get: function () {
2471
+ return BubbleMenuDefault;
2472
+ }
2473
+ });
2474
+ Object.defineProperty(exports, 'BubbleMenuItalic', {
2475
+ enumerable: true,
2476
+ get: function () {
2477
+ return BubbleMenuItalic;
2478
+ }
2479
+ });
2480
+ Object.defineProperty(exports, 'BubbleMenuItem', {
2481
+ enumerable: true,
2482
+ get: function () {
2483
+ return BubbleMenuItem;
2484
+ }
2485
+ });
2486
+ Object.defineProperty(exports, 'BubbleMenuItemGroup', {
2487
+ enumerable: true,
2488
+ get: function () {
2489
+ return BubbleMenuItemGroup;
2490
+ }
2491
+ });
2492
+ Object.defineProperty(exports, 'BubbleMenuLinkSelector', {
2493
+ enumerable: true,
2494
+ get: function () {
2495
+ return BubbleMenuLinkSelector;
2496
+ }
2497
+ });
2498
+ Object.defineProperty(exports, 'BubbleMenuNodeSelector', {
2499
+ enumerable: true,
2500
+ get: function () {
2501
+ return BubbleMenuNodeSelector;
2502
+ }
2503
+ });
2504
+ Object.defineProperty(exports, 'BubbleMenuRoot', {
2505
+ enumerable: true,
2506
+ get: function () {
2507
+ return BubbleMenuRoot;
2508
+ }
2509
+ });
2510
+ Object.defineProperty(exports, 'BubbleMenuStrike', {
2511
+ enumerable: true,
2512
+ get: function () {
2513
+ return BubbleMenuStrike;
2514
+ }
2515
+ });
2516
+ Object.defineProperty(exports, 'BubbleMenuUnderline', {
2517
+ enumerable: true,
2518
+ get: function () {
2519
+ return BubbleMenuUnderline;
2520
+ }
2521
+ });
2522
+ Object.defineProperty(exports, 'BubbleMenuUppercase', {
2523
+ enumerable: true,
2524
+ get: function () {
2525
+ return BubbleMenuUppercase;
2526
+ }
2527
+ });
2528
+ Object.defineProperty(exports, 'ButtonBubbleMenuDefault', {
2529
+ enumerable: true,
2530
+ get: function () {
2531
+ return ButtonBubbleMenuDefault;
2532
+ }
2533
+ });
2534
+ Object.defineProperty(exports, 'ButtonBubbleMenuEditLink', {
2535
+ enumerable: true,
2536
+ get: function () {
2537
+ return ButtonBubbleMenuEditLink;
2538
+ }
2539
+ });
2540
+ Object.defineProperty(exports, 'ButtonBubbleMenuForm', {
2541
+ enumerable: true,
2542
+ get: function () {
2543
+ return ButtonBubbleMenuForm;
2544
+ }
2545
+ });
2546
+ Object.defineProperty(exports, 'ButtonBubbleMenuRoot', {
2547
+ enumerable: true,
2548
+ get: function () {
2549
+ return ButtonBubbleMenuRoot;
2550
+ }
2551
+ });
2552
+ Object.defineProperty(exports, 'ButtonBubbleMenuToolbar', {
2553
+ enumerable: true,
2554
+ get: function () {
2555
+ return ButtonBubbleMenuToolbar;
2556
+ }
2557
+ });
2558
+ Object.defineProperty(exports, 'ButtonBubbleMenuUnlink', {
2559
+ enumerable: true,
2560
+ get: function () {
2561
+ return ButtonBubbleMenuUnlink;
2562
+ }
2563
+ });
2564
+ Object.defineProperty(exports, 'CODE', {
2565
+ enumerable: true,
2566
+ get: function () {
2567
+ return CODE;
2568
+ }
2569
+ });
2570
+ Object.defineProperty(exports, 'CaseUpperIcon', {
2571
+ enumerable: true,
2572
+ get: function () {
2573
+ return CaseUpperIcon;
2574
+ }
2575
+ });
2576
+ Object.defineProperty(exports, 'Check', {
2577
+ enumerable: true,
2578
+ get: function () {
2579
+ return Check;
2580
+ }
2581
+ });
2582
+ Object.defineProperty(exports, 'ChevronDown', {
2583
+ enumerable: true,
2584
+ get: function () {
2585
+ return ChevronDown;
2586
+ }
2587
+ });
2588
+ Object.defineProperty(exports, 'Code', {
2589
+ enumerable: true,
2590
+ get: function () {
2591
+ return Code;
2592
+ }
2593
+ });
2594
+ Object.defineProperty(exports, 'CodeIcon', {
2595
+ enumerable: true,
2596
+ get: function () {
2597
+ return CodeIcon;
2598
+ }
2599
+ });
2600
+ Object.defineProperty(exports, 'Columns2', {
2601
+ enumerable: true,
2602
+ get: function () {
2603
+ return Columns2;
2604
+ }
2605
+ });
2606
+ Object.defineProperty(exports, 'Columns3', {
2607
+ enumerable: true,
2608
+ get: function () {
2609
+ return Columns3;
2610
+ }
2611
+ });
2612
+ Object.defineProperty(exports, 'Columns4', {
2613
+ enumerable: true,
2614
+ get: function () {
2615
+ return Columns4;
2616
+ }
2617
+ });
2618
+ Object.defineProperty(exports, 'CommandList', {
2619
+ enumerable: true,
2620
+ get: function () {
2621
+ return CommandList;
2622
+ }
2623
+ });
2624
+ Object.defineProperty(exports, 'DIVIDER', {
2625
+ enumerable: true,
2626
+ get: function () {
2627
+ return DIVIDER;
2628
+ }
2629
+ });
2630
+ Object.defineProperty(exports, 'ExternalLinkIcon', {
2631
+ enumerable: true,
2632
+ get: function () {
2633
+ return ExternalLinkIcon;
2634
+ }
2635
+ });
2636
+ Object.defineProperty(exports, 'FOUR_COLUMNS', {
2637
+ enumerable: true,
2638
+ get: function () {
2639
+ return FOUR_COLUMNS;
2640
+ }
2641
+ });
2642
+ Object.defineProperty(exports, 'H1', {
2643
+ enumerable: true,
2644
+ get: function () {
2645
+ return H1;
2646
+ }
2647
+ });
2648
+ Object.defineProperty(exports, 'H2', {
2649
+ enumerable: true,
2650
+ get: function () {
2651
+ return H2;
2652
+ }
2653
+ });
2654
+ Object.defineProperty(exports, 'H3', {
2655
+ enumerable: true,
2656
+ get: function () {
2657
+ return H3;
2658
+ }
2659
+ });
2660
+ Object.defineProperty(exports, 'Heading1', {
2661
+ enumerable: true,
2662
+ get: function () {
2663
+ return Heading1;
2664
+ }
2665
+ });
2666
+ Object.defineProperty(exports, 'Heading2', {
2667
+ enumerable: true,
2668
+ get: function () {
2669
+ return Heading2;
2670
+ }
2671
+ });
2672
+ Object.defineProperty(exports, 'Heading3', {
2673
+ enumerable: true,
2674
+ get: function () {
2675
+ return Heading3;
2676
+ }
2677
+ });
2678
+ Object.defineProperty(exports, 'ImageBubbleMenuDefault', {
2679
+ enumerable: true,
2680
+ get: function () {
2681
+ return ImageBubbleMenuDefault;
2682
+ }
2683
+ });
2684
+ Object.defineProperty(exports, 'ImageBubbleMenuEditLink', {
2685
+ enumerable: true,
2686
+ get: function () {
2687
+ return ImageBubbleMenuEditLink;
2688
+ }
2689
+ });
2690
+ Object.defineProperty(exports, 'ImageBubbleMenuRoot', {
2691
+ enumerable: true,
2692
+ get: function () {
2693
+ return ImageBubbleMenuRoot;
2694
+ }
2695
+ });
2696
+ Object.defineProperty(exports, 'ImageBubbleMenuToolbar', {
2697
+ enumerable: true,
2698
+ get: function () {
2699
+ return ImageBubbleMenuToolbar;
2700
+ }
2701
+ });
2702
+ Object.defineProperty(exports, 'ItalicIcon', {
2703
+ enumerable: true,
2704
+ get: function () {
2705
+ return ItalicIcon;
2706
+ }
2707
+ });
2708
+ Object.defineProperty(exports, 'LinkBubbleMenuDefault', {
2709
+ enumerable: true,
2710
+ get: function () {
2711
+ return LinkBubbleMenuDefault;
2712
+ }
2713
+ });
2714
+ Object.defineProperty(exports, 'LinkBubbleMenuEditLink', {
2715
+ enumerable: true,
2716
+ get: function () {
2717
+ return LinkBubbleMenuEditLink;
2718
+ }
2719
+ });
2720
+ Object.defineProperty(exports, 'LinkBubbleMenuForm', {
2721
+ enumerable: true,
2722
+ get: function () {
2723
+ return LinkBubbleMenuForm;
2724
+ }
2725
+ });
2726
+ Object.defineProperty(exports, 'LinkBubbleMenuOpenLink', {
2727
+ enumerable: true,
2728
+ get: function () {
2729
+ return LinkBubbleMenuOpenLink;
2730
+ }
2731
+ });
2732
+ Object.defineProperty(exports, 'LinkBubbleMenuRoot', {
2733
+ enumerable: true,
2734
+ get: function () {
2735
+ return LinkBubbleMenuRoot;
2736
+ }
2737
+ });
2738
+ Object.defineProperty(exports, 'LinkBubbleMenuToolbar', {
2739
+ enumerable: true,
2740
+ get: function () {
2741
+ return LinkBubbleMenuToolbar;
2742
+ }
2743
+ });
2744
+ Object.defineProperty(exports, 'LinkBubbleMenuUnlink', {
2745
+ enumerable: true,
2746
+ get: function () {
2747
+ return LinkBubbleMenuUnlink;
2748
+ }
2749
+ });
2750
+ Object.defineProperty(exports, 'LinkIcon', {
2751
+ enumerable: true,
2752
+ get: function () {
2753
+ return LinkIcon;
2754
+ }
2755
+ });
2756
+ Object.defineProperty(exports, 'List', {
2757
+ enumerable: true,
2758
+ get: function () {
2759
+ return List;
2760
+ }
2761
+ });
2762
+ Object.defineProperty(exports, 'ListOrdered', {
2763
+ enumerable: true,
2764
+ get: function () {
2765
+ return ListOrdered;
2766
+ }
2767
+ });
2768
+ Object.defineProperty(exports, 'MousePointer', {
2769
+ enumerable: true,
2770
+ get: function () {
2771
+ return MousePointer;
2772
+ }
2773
+ });
2774
+ Object.defineProperty(exports, 'NUMBERED_LIST', {
2775
+ enumerable: true,
2776
+ get: function () {
2777
+ return NUMBERED_LIST;
2778
+ }
2779
+ });
2780
+ Object.defineProperty(exports, 'NodeSelectorContent', {
2781
+ enumerable: true,
2782
+ get: function () {
2783
+ return NodeSelectorContent;
2784
+ }
2785
+ });
2786
+ Object.defineProperty(exports, 'NodeSelectorRoot', {
2787
+ enumerable: true,
2788
+ get: function () {
2789
+ return NodeSelectorRoot;
2790
+ }
2791
+ });
2792
+ Object.defineProperty(exports, 'NodeSelectorTrigger', {
2793
+ enumerable: true,
2794
+ get: function () {
2795
+ return NodeSelectorTrigger;
2796
+ }
2797
+ });
2798
+ Object.defineProperty(exports, 'PencilIcon', {
2799
+ enumerable: true,
2800
+ get: function () {
2801
+ return PencilIcon;
2802
+ }
2803
+ });
2804
+ Object.defineProperty(exports, 'QUOTE', {
2805
+ enumerable: true,
2806
+ get: function () {
2807
+ return QUOTE;
2808
+ }
2809
+ });
2810
+ Object.defineProperty(exports, 'Rows2', {
2811
+ enumerable: true,
2812
+ get: function () {
2813
+ return Rows2;
2814
+ }
2815
+ });
2816
+ Object.defineProperty(exports, 'SECTION', {
2817
+ enumerable: true,
2818
+ get: function () {
2819
+ return SECTION;
2820
+ }
2821
+ });
2822
+ Object.defineProperty(exports, 'SlashCommandRoot', {
2823
+ enumerable: true,
2824
+ get: function () {
2825
+ return SlashCommandRoot;
2826
+ }
2827
+ });
2828
+ Object.defineProperty(exports, 'SplitSquareVertical', {
2829
+ enumerable: true,
2830
+ get: function () {
2831
+ return SplitSquareVertical;
2832
+ }
2833
+ });
2834
+ Object.defineProperty(exports, 'SquareCode', {
2835
+ enumerable: true,
2836
+ get: function () {
2837
+ return SquareCode;
2838
+ }
2839
+ });
2840
+ Object.defineProperty(exports, 'StrikethroughIcon', {
2841
+ enumerable: true,
2842
+ get: function () {
2843
+ return StrikethroughIcon;
2844
+ }
2845
+ });
2846
+ Object.defineProperty(exports, 'TEXT', {
2847
+ enumerable: true,
2848
+ get: function () {
2849
+ return TEXT;
2850
+ }
2851
+ });
2852
+ Object.defineProperty(exports, 'THREE_COLUMNS', {
2853
+ enumerable: true,
2854
+ get: function () {
2855
+ return THREE_COLUMNS;
2856
+ }
2857
+ });
2858
+ Object.defineProperty(exports, 'TWO_COLUMNS', {
2859
+ enumerable: true,
2860
+ get: function () {
2861
+ return TWO_COLUMNS;
2862
+ }
2863
+ });
2864
+ Object.defineProperty(exports, 'Text', {
2865
+ enumerable: true,
2866
+ get: function () {
2867
+ return Text;
2868
+ }
2869
+ });
2870
+ Object.defineProperty(exports, 'TextIcon', {
2871
+ enumerable: true,
2872
+ get: function () {
2873
+ return TextIcon;
2874
+ }
2875
+ });
2876
+ Object.defineProperty(exports, 'TextQuote', {
2877
+ enumerable: true,
2878
+ get: function () {
2879
+ return TextQuote;
2880
+ }
2881
+ });
2882
+ Object.defineProperty(exports, 'UnderlineIcon', {
2883
+ enumerable: true,
2884
+ get: function () {
2885
+ return UnderlineIcon;
2886
+ }
2887
+ });
2888
+ Object.defineProperty(exports, 'UnlinkIcon', {
2889
+ enumerable: true,
2890
+ get: function () {
2891
+ return UnlinkIcon;
2892
+ }
2893
+ });
2894
+ Object.defineProperty(exports, 'defaultSlashCommands', {
2895
+ enumerable: true,
2896
+ get: function () {
2897
+ return defaultSlashCommands;
2898
+ }
2899
+ });
2900
+ Object.defineProperty(exports, 'filterAndRankItems', {
2901
+ enumerable: true,
2902
+ get: function () {
2903
+ return filterAndRankItems;
2904
+ }
2905
+ });
2906
+ Object.defineProperty(exports, 'isAtMaxColumnsDepth', {
2907
+ enumerable: true,
2908
+ get: function () {
2909
+ return isAtMaxColumnsDepth;
2910
+ }
2911
+ });
2912
+ Object.defineProperty(exports, 'isInsideNode', {
2913
+ enumerable: true,
2914
+ get: function () {
2915
+ return isInsideNode;
2916
+ }
2917
+ });
2918
+ Object.defineProperty(exports, 'scoreItem', {
2919
+ enumerable: true,
2920
+ get: function () {
2921
+ return scoreItem;
2922
+ }
2923
+ });
2924
+ Object.defineProperty(exports, 'useButtonBubbleMenuContext', {
2925
+ enumerable: true,
2926
+ get: function () {
2927
+ return useButtonBubbleMenuContext;
2928
+ }
2929
+ });
2930
+ Object.defineProperty(exports, 'useImageBubbleMenuContext', {
2931
+ enumerable: true,
2932
+ get: function () {
2933
+ return useImageBubbleMenuContext;
2934
+ }
2935
+ });
2936
+ Object.defineProperty(exports, 'useLinkBubbleMenuContext', {
2937
+ enumerable: true,
2938
+ get: function () {
2939
+ return useLinkBubbleMenuContext;
2940
+ }
2941
+ });