@react-email/editor 0.0.0-experimental.41 → 0.0.0-experimental.43

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 (67) hide show
  1. package/dist/core/index.cjs +4 -3
  2. package/dist/core/index.d.cts +2 -2
  3. package/dist/core/index.d.mts +3 -3
  4. package/dist/core/index.mjs +3 -3
  5. package/dist/{create-paste-handler-CGR738bC.d.mts → create-paste-handler-DsJYKisA.d.mts} +1 -1
  6. package/dist/{create-paste-handler-CGR738bC.d.mts.map → create-paste-handler-DsJYKisA.d.mts.map} +1 -1
  7. package/dist/{event-bus-fb8U7hrl.cjs → event-bus-BJn1dJM1.cjs} +20 -3
  8. package/dist/{event-bus-CHEzOS_O.mjs → event-bus-DJpnfDHw.mjs} +14 -3
  9. package/dist/{event-bus-CHEzOS_O.mjs.map → event-bus-DJpnfDHw.mjs.map} +1 -1
  10. package/dist/{extension-w5VaUeSw.cjs → extension-CF0s-pGh.cjs} +301 -37
  11. package/dist/{extension-DyY8_bh4.mjs → extension-DcToBuV0.mjs} +301 -13
  12. package/dist/extension-DcToBuV0.mjs.map +1 -0
  13. package/dist/extensions/index.cjs +3 -3
  14. package/dist/extensions/index.d.cts +1 -1
  15. package/dist/extensions/index.d.cts.map +1 -1
  16. package/dist/extensions/index.d.mts +2 -2
  17. package/dist/extensions/index.d.mts.map +1 -1
  18. package/dist/extensions/index.mjs +3 -3
  19. package/dist/{extensions-CkjPj2JO.cjs → extensions-B6VCxUmi.cjs} +68 -25
  20. package/dist/{extensions-BvfmaKCn.mjs → extensions-mStGDfMH.mjs} +63 -20
  21. package/dist/extensions-mStGDfMH.mjs.map +1 -0
  22. package/dist/{styles-C-cCyJCn.cjs → global-content-C5WjNoMX.cjs} +88 -0
  23. package/dist/{styles-_TMw3YxC.mjs → global-content-CjA49_jE.mjs} +78 -2
  24. package/dist/global-content-CjA49_jE.mjs.map +1 -0
  25. package/dist/{index-C4KcMQ0R.d.cts → index-LCPnE_xx.d.cts} +66 -3
  26. package/dist/index-LCPnE_xx.d.cts.map +1 -0
  27. package/dist/{index-CxX7W63O.d.mts → index-i5JdL0UD.d.mts} +67 -4
  28. package/dist/index-i5JdL0UD.d.mts.map +1 -0
  29. package/dist/index.cjs +4 -4
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.d.mts.map +1 -1
  32. package/dist/index.mjs +3 -3
  33. package/dist/plugins/index.cjs +1 -5
  34. package/dist/plugins/index.d.cts +5 -123
  35. package/dist/plugins/index.d.cts.map +1 -1
  36. package/dist/plugins/index.d.mts +5 -123
  37. package/dist/plugins/index.d.mts.map +1 -1
  38. package/dist/plugins/index.mjs +2 -2
  39. package/dist/{root-pS4l8bVZ.mjs → root-BVs63m-4.mjs} +39 -39
  40. package/dist/root-BVs63m-4.mjs.map +1 -0
  41. package/dist/{root-Jq1R3tkX.cjs → root-D6lslKju.cjs} +2 -2
  42. package/dist/{set-text-alignment-OA8IMWmO.mjs → set-text-alignment-GMXOPMlJ.mjs} +1 -1
  43. package/dist/{set-text-alignment-OA8IMWmO.mjs.map → set-text-alignment-GMXOPMlJ.mjs.map} +1 -1
  44. package/dist/types-BNEbRz-a.d.cts +47 -0
  45. package/dist/types-BNEbRz-a.d.cts.map +1 -0
  46. package/dist/types-C8k-blF7.d.mts +47 -0
  47. package/dist/types-C8k-blF7.d.mts.map +1 -0
  48. package/dist/ui/index.cjs +645 -2
  49. package/dist/ui/index.d.cts +307 -128
  50. package/dist/ui/index.d.cts.map +1 -1
  51. package/dist/ui/index.d.mts +263 -84
  52. package/dist/ui/index.d.mts.map +1 -1
  53. package/dist/ui/index.mjs +630 -3
  54. package/dist/ui/index.mjs.map +1 -1
  55. package/dist/utils/index.cjs +1 -1
  56. package/dist/utils/index.mjs +1 -1
  57. package/package.json +2 -2
  58. package/dist/extension-DyY8_bh4.mjs.map +0 -1
  59. package/dist/extensions-BvfmaKCn.mjs.map +0 -1
  60. package/dist/global-content-D_WYaFgX.mjs +0 -78
  61. package/dist/global-content-D_WYaFgX.mjs.map +0 -1
  62. package/dist/global-content-bJgotqmA.cjs +0 -89
  63. package/dist/index-C4KcMQ0R.d.cts.map +0 -1
  64. package/dist/index-CxX7W63O.d.mts.map +0 -1
  65. package/dist/root-pS4l8bVZ.mjs.map +0 -1
  66. package/dist/styles-_TMw3YxC.mjs.map +0 -1
  67. /package/dist/{set-text-alignment-Cv72txmv.cjs → set-text-alignment-aNb7Ml9N.cjs} +0 -0
package/dist/ui/index.cjs CHANGED
@@ -1,7 +1,321 @@
1
- const require_event_bus = require('../event-bus-fb8U7hrl.cjs');
2
- const require_root = require('../root-Jq1R3tkX.cjs');
1
+ const require_event_bus = require('../event-bus-BJn1dJM1.cjs');
2
+ const require_extension = require('../extension-CF0s-pGh.cjs');
3
+ const require_root = require('../root-D6lslKju.cjs');
4
+ let _tiptap_react = require("@tiptap/react");
5
+ let react = require("react");
6
+ react = require_event_bus.__toESM(react);
3
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let _tiptap_core = require("@tiptap/core");
9
+ let _tiptap_pm_state = require("@tiptap/pm/state");
4
10
 
11
+ //#region src/ui/icons/align-center-vertical.tsx
12
+ function AlignCenterVerticalIcon({ size, width, height, ...props }) {
13
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ width: size ?? width ?? 24,
16
+ height: size ?? height ?? 24,
17
+ viewBox: "0 0 24 24",
18
+ fill: "none",
19
+ stroke: "currentColor",
20
+ strokeWidth: 2,
21
+ strokeLinecap: "round",
22
+ strokeLinejoin: "round",
23
+ "aria-hidden": "true",
24
+ ...props,
25
+ children: [
26
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 2v20" }),
27
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" }),
28
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" }),
29
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" }),
30
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" })
31
+ ]
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ //#region src/ui/icons/align-end-vertical.tsx
37
+ function AlignEndVerticalIcon({ size, width, height, ...props }) {
38
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
39
+ xmlns: "http://www.w3.org/2000/svg",
40
+ width: size ?? width ?? 24,
41
+ height: size ?? height ?? 24,
42
+ viewBox: "0 0 24 24",
43
+ fill: "none",
44
+ stroke: "currentColor",
45
+ strokeWidth: 2,
46
+ strokeLinecap: "round",
47
+ strokeLinejoin: "round",
48
+ "aria-hidden": "true",
49
+ ...props,
50
+ children: [
51
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
52
+ width: "9",
53
+ height: "6",
54
+ x: "9",
55
+ y: "14",
56
+ rx: "2"
57
+ }),
58
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
59
+ width: "16",
60
+ height: "6",
61
+ x: "2",
62
+ y: "4",
63
+ rx: "2"
64
+ }),
65
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M22 2v20" })
66
+ ]
67
+ });
68
+ }
69
+
70
+ //#endregion
71
+ //#region src/ui/icons/align-start-vertical.tsx
72
+ function AlignStartVerticalIcon({ size, width, height, ...props }) {
73
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
74
+ xmlns: "http://www.w3.org/2000/svg",
75
+ width: size ?? width ?? 24,
76
+ height: size ?? height ?? 24,
77
+ viewBox: "0 0 24 24",
78
+ fill: "none",
79
+ stroke: "currentColor",
80
+ strokeWidth: 2,
81
+ strokeLinecap: "round",
82
+ strokeLinejoin: "round",
83
+ "aria-hidden": "true",
84
+ ...props,
85
+ children: [
86
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
87
+ width: "9",
88
+ height: "6",
89
+ x: "6",
90
+ y: "14",
91
+ rx: "2"
92
+ }),
93
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
94
+ width: "16",
95
+ height: "6",
96
+ x: "6",
97
+ y: "4",
98
+ rx: "2"
99
+ }),
100
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2 2v20" })
101
+ ]
102
+ });
103
+ }
104
+
105
+ //#endregion
106
+ //#region src/ui/icons/box.tsx
107
+ function BoxIcon({ size, width, height, ...props }) {
108
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
109
+ xmlns: "http://www.w3.org/2000/svg",
110
+ width: size ?? width ?? 24,
111
+ height: size ?? height ?? 24,
112
+ viewBox: "0 0 24 24",
113
+ fill: "none",
114
+ stroke: "currentColor",
115
+ strokeWidth: 2,
116
+ strokeLinecap: "round",
117
+ strokeLinejoin: "round",
118
+ "aria-hidden": "true",
119
+ ...props,
120
+ children: [
121
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z" }),
122
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m3.3 7 8.7 5 8.7-5" }),
123
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 22V12" })
124
+ ]
125
+ });
126
+ }
127
+
128
+ //#endregion
129
+ //#region src/ui/icons/image.tsx
130
+ function ImageIcon({ size, width, height, ...props }) {
131
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
132
+ xmlns: "http://www.w3.org/2000/svg",
133
+ width: size ?? width ?? 24,
134
+ height: size ?? height ?? 24,
135
+ viewBox: "0 0 24 24",
136
+ fill: "none",
137
+ stroke: "currentColor",
138
+ strokeWidth: 2,
139
+ strokeLinecap: "round",
140
+ strokeLinejoin: "round",
141
+ "aria-hidden": "true",
142
+ ...props,
143
+ children: [
144
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
145
+ width: "18",
146
+ height: "18",
147
+ x: "3",
148
+ y: "3",
149
+ rx: "2",
150
+ ry: "2"
151
+ }),
152
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
153
+ cx: "9",
154
+ cy: "9",
155
+ r: "2"
156
+ }),
157
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
158
+ ]
159
+ });
160
+ }
161
+
162
+ //#endregion
163
+ //#region src/ui/icons/layout.tsx
164
+ function LayoutIcon({ size, width, height, ...props }) {
165
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
166
+ xmlns: "http://www.w3.org/2000/svg",
167
+ width: size ?? width ?? 24,
168
+ height: size ?? height ?? 24,
169
+ viewBox: "0 0 24 24",
170
+ fill: "none",
171
+ stroke: "currentColor",
172
+ strokeWidth: 2,
173
+ strokeLinecap: "round",
174
+ strokeLinejoin: "round",
175
+ "aria-hidden": "true",
176
+ ...props,
177
+ children: [
178
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
179
+ width: "18",
180
+ height: "18",
181
+ x: "3",
182
+ y: "3",
183
+ rx: "2",
184
+ ry: "2"
185
+ }),
186
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 9h18" }),
187
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 21V9" })
188
+ ]
189
+ });
190
+ }
191
+
192
+ //#endregion
193
+ //#region src/ui/icons/minus.tsx
194
+ function MinusIcon({ size, width, height, ...props }) {
195
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
196
+ xmlns: "http://www.w3.org/2000/svg",
197
+ width: size ?? width ?? 24,
198
+ height: size ?? height ?? 24,
199
+ viewBox: "0 0 24 24",
200
+ fill: "none",
201
+ stroke: "currentColor",
202
+ strokeWidth: 2,
203
+ strokeLinecap: "round",
204
+ strokeLinejoin: "round",
205
+ "aria-hidden": "true",
206
+ ...props,
207
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" })
208
+ });
209
+ }
210
+
211
+ //#endregion
212
+ //#region src/ui/icons/mouse-pointer-click.tsx
213
+ function MousePointerClickIcon({ size, width, height, ...props }) {
214
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
215
+ xmlns: "http://www.w3.org/2000/svg",
216
+ width: size ?? width ?? 24,
217
+ height: size ?? height ?? 24,
218
+ viewBox: "0 0 24 24",
219
+ fill: "none",
220
+ stroke: "currentColor",
221
+ strokeWidth: 2,
222
+ strokeLinecap: "round",
223
+ strokeLinejoin: "round",
224
+ "aria-hidden": "true",
225
+ ...props,
226
+ children: [
227
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 4.1 12 6" }),
228
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m5.1 8-2.9-.8" }),
229
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 12-1.9 2" }),
230
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7.2 2.2 8 5.1" }),
231
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z" })
232
+ ]
233
+ });
234
+ }
235
+
236
+ //#endregion
237
+ //#region src/ui/icons/square-round-corner.tsx
238
+ function SquareRoundCornerIcon({ size, width, height, ...props }) {
239
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
240
+ xmlns: "http://www.w3.org/2000/svg",
241
+ width: size ?? width ?? 24,
242
+ height: size ?? height ?? 24,
243
+ viewBox: "0 0 24 24",
244
+ fill: "none",
245
+ stroke: "currentColor",
246
+ strokeWidth: 2,
247
+ strokeLinecap: "round",
248
+ strokeLinejoin: "round",
249
+ "aria-hidden": "true",
250
+ ...props,
251
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 3a8 8 0 0 1 8 8" })]
252
+ });
253
+ }
254
+
255
+ //#endregion
256
+ //#region src/ui/icons/table.tsx
257
+ function TableIcon({ size, width, height, ...props }) {
258
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
259
+ xmlns: "http://www.w3.org/2000/svg",
260
+ width: size ?? width ?? 24,
261
+ height: size ?? height ?? 24,
262
+ viewBox: "0 0 24 24",
263
+ fill: "none",
264
+ stroke: "currentColor",
265
+ strokeWidth: 2,
266
+ strokeLinecap: "round",
267
+ strokeLinejoin: "round",
268
+ "aria-hidden": "true",
269
+ ...props,
270
+ children: [
271
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 3v18" }),
272
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
273
+ width: "18",
274
+ height: "18",
275
+ x: "3",
276
+ y: "3",
277
+ rx: "2"
278
+ }),
279
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 9h18" }),
280
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 15h18" })
281
+ ]
282
+ });
283
+ }
284
+
285
+ //#endregion
286
+ //#region src/ui/icons/type.tsx
287
+ function TypeIcon({ size, width, height, ...props }) {
288
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
289
+ xmlns: "http://www.w3.org/2000/svg",
290
+ width: size ?? width ?? 24,
291
+ height: size ?? height ?? 24,
292
+ viewBox: "0 0 24 24",
293
+ fill: "none",
294
+ stroke: "currentColor",
295
+ strokeWidth: 2,
296
+ strokeLinecap: "round",
297
+ strokeLinejoin: "round",
298
+ "aria-hidden": "true",
299
+ ...props,
300
+ children: [
301
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "4 7 4 4 20 4 20 7" }),
302
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
303
+ x1: "9",
304
+ x2: "15",
305
+ y1: "20",
306
+ y2: "20"
307
+ }),
308
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
309
+ x1: "12",
310
+ x2: "12",
311
+ y1: "4",
312
+ y2: "20"
313
+ })
314
+ ]
315
+ });
316
+ }
317
+
318
+ //#endregion
5
319
  //#region src/ui/bubble-menu/separator.tsx
6
320
  function BubbleMenuSeparator({ className }) {
7
321
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {
@@ -49,6 +363,319 @@ const BubbleMenu = {
49
363
  ImageDefault: require_root.BubbleMenuImageDefault
50
364
  };
51
365
 
366
+ //#endregion
367
+ //#region src/ui/inspector/provider.tsx
368
+ const IGNORED_NODES = ["doc", "text"];
369
+ function getHierarchyAtPosition(editor, pos) {
370
+ if (!editor) return [];
371
+ const { doc } = editor.state;
372
+ const hierarchy = [];
373
+ const nodeAtPos = doc.nodeAt(pos);
374
+ if (nodeAtPos && !IGNORED_NODES.includes(nodeAtPos.type.name)) hierarchy.push({
375
+ nodeType: nodeAtPos.type.name,
376
+ nodeAttrs: { ...nodeAtPos.attrs },
377
+ nodePos: {
378
+ pos,
379
+ inside: pos
380
+ }
381
+ });
382
+ const resolvedPos = doc.resolve(pos);
383
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
384
+ const node = resolvedPos.node(depth);
385
+ const nodePos = resolvedPos.before(depth);
386
+ if (node && !IGNORED_NODES.includes(node.type.name)) {
387
+ if (!hierarchy.some((h) => h.nodePos.pos === nodePos)) hierarchy.push({
388
+ nodeType: node.type.name,
389
+ nodeAttrs: { ...node.attrs },
390
+ nodePos: {
391
+ pos: nodePos,
392
+ inside: nodePos
393
+ }
394
+ });
395
+ }
396
+ }
397
+ return hierarchy;
398
+ }
399
+ function getNodeHierarchy(editor) {
400
+ if (!editor) return [];
401
+ const { selection } = editor.state;
402
+ const hierarchy = [];
403
+ if (selection instanceof _tiptap_pm_state.NodeSelection) {
404
+ const node = selection.node;
405
+ if (node && !IGNORED_NODES.includes(node.type.name)) hierarchy.push({
406
+ nodeType: node.type.name,
407
+ nodeAttrs: { ...node.attrs },
408
+ nodePos: {
409
+ pos: selection.from,
410
+ inside: selection.from
411
+ }
412
+ });
413
+ }
414
+ const { from } = selection;
415
+ const resolvedPos = editor.state.doc.resolve(from);
416
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
417
+ const node = resolvedPos.node(depth);
418
+ const pos = resolvedPos.before(depth);
419
+ if (node && !IGNORED_NODES.includes(node.type.name)) {
420
+ if (!hierarchy.some((h) => h.nodePos.pos === pos)) hierarchy.push({
421
+ nodeType: node.type.name,
422
+ nodeAttrs: { ...node.attrs },
423
+ nodePos: {
424
+ pos,
425
+ inside: pos
426
+ }
427
+ });
428
+ }
429
+ }
430
+ return hierarchy;
431
+ }
432
+ const InspectorContext = react.createContext(null);
433
+ function useInspector() {
434
+ const context = react.useContext(InspectorContext);
435
+ if (!context) throw new Error("useInspector can only be called from inside the InspectorContext. This probably means you forgot the <Inspector.Provider>");
436
+ return context;
437
+ }
438
+ function InspectorProvider({ children }) {
439
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
440
+ const target = (0, _tiptap_react.useEditorState)({
441
+ editor,
442
+ selector(context) {
443
+ if (!context.editor) return null;
444
+ if (!context.editor.isFocused) return "doc";
445
+ const { selection } = context.editor.state;
446
+ if (selection.content().size > 0 && selection instanceof _tiptap_pm_state.TextSelection) {
447
+ const { $from } = selection;
448
+ for (let depth = $from.depth; depth > 0; depth--) if ($from.node(depth).type.name === "button") {
449
+ const pos = $from.before(depth);
450
+ const node = context.editor.state.doc.nodeAt(pos);
451
+ if (node) return {
452
+ nodeType: "button",
453
+ nodeAttrs: { ...node.attrs },
454
+ nodePos: {
455
+ pos,
456
+ inside: pos
457
+ }
458
+ };
459
+ break;
460
+ }
461
+ return "text";
462
+ }
463
+ const hierarchy = getNodeHierarchy(context.editor);
464
+ if (hierarchy.length > 0) {
465
+ const innermost = hierarchy[0];
466
+ const columnEntry = hierarchy.find((h) => h.nodeType === "columnsColumn");
467
+ return columnEntry && innermost.nodeType === "paragraph" ? columnEntry : innermost;
468
+ }
469
+ return "doc";
470
+ }
471
+ });
472
+ const pathFromRoot = react.useMemo(() => {
473
+ if (!editor) return [];
474
+ if (typeof target === "object" && target) {
475
+ const path = [...getHierarchyAtPosition(editor, target.nodePos.pos)].reverse();
476
+ return path.length > 0 ? path : [target];
477
+ }
478
+ if (target === "text") return [...getNodeHierarchy(editor)].reverse();
479
+ return [];
480
+ }, [editor, target]);
481
+ const editorDomFocused = react.useRef(false);
482
+ const inspectorFocused = react.useRef(false);
483
+ react.useEffect(() => {
484
+ const defaultFocusPlugin = editor?.state.plugins.find((plugin) => plugin.spec.key === _tiptap_core.extensions.focusEventsPluginKey);
485
+ if (editor && defaultFocusPlugin) {
486
+ editor?.unregisterPlugin(_tiptap_core.extensions.focusEventsPluginKey);
487
+ const pluginKey = new _tiptap_pm_state.PluginKey("inspectorReactEmailFocusEvents");
488
+ editor.registerPlugin(new _tiptap_pm_state.Plugin({
489
+ key: pluginKey,
490
+ props: { handleDOMEvents: {
491
+ focus: (view, event) => {
492
+ editorDomFocused.current = true;
493
+ editor.isFocused = true;
494
+ const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
495
+ view.dispatch(transaction);
496
+ return false;
497
+ },
498
+ blur: (view, event) => {
499
+ editorDomFocused.current = false;
500
+ if (!inspectorFocused.current) {
501
+ editor.isFocused = false;
502
+ const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
503
+ view.dispatch(transaction);
504
+ }
505
+ return false;
506
+ }
507
+ } }
508
+ }));
509
+ return () => {
510
+ editor?.unregisterPlugin(pluginKey);
511
+ editor?.registerPlugin(defaultFocusPlugin);
512
+ };
513
+ }
514
+ }, [editor]);
515
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorContext.Provider, {
516
+ value: {
517
+ target,
518
+ pathFromRoot,
519
+ focus: (event) => {
520
+ inspectorFocused.current = true;
521
+ if (editor) {
522
+ editor.isFocused = true;
523
+ const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
524
+ editor.view.dispatch(transaction);
525
+ }
526
+ },
527
+ blur: (event) => {
528
+ inspectorFocused.current = false;
529
+ if (!editorDomFocused.current && editor) {
530
+ editor.isFocused = false;
531
+ const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
532
+ editor.view.dispatch(transaction);
533
+ }
534
+ }
535
+ },
536
+ children
537
+ });
538
+ }
539
+
540
+ //#endregion
541
+ //#region src/ui/inspector/breadcrumb.tsx
542
+ function InspectorBreadcrumb({ children }) {
543
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
544
+ const { pathFromRoot } = useInspector();
545
+ return children(react.default.useMemo(() => {
546
+ return [{
547
+ node: null,
548
+ focus() {
549
+ editor?.commands.setTextSelection(0);
550
+ }
551
+ }, ...pathFromRoot.map((focusedNode) => ({
552
+ node: focusedNode,
553
+ focus() {
554
+ editor?.commands.setNodeSelection(focusedNode.nodePos.pos);
555
+ editor?.commands.focus();
556
+ }
557
+ }))];
558
+ }, [pathFromRoot]));
559
+ }
560
+
561
+ //#endregion
562
+ //#region src/ui/inspector/document.tsx
563
+ function ensureAllProperties(currentStyles, themeDefaults) {
564
+ return currentStyles.map((group) => {
565
+ const defaultGroup = themeDefaults.find((g) => group.id ? g.id === group.id : g.title === group.title);
566
+ if (!defaultGroup || defaultGroup.inputs.length === 0) return group;
567
+ const existingProps = new Set(group.inputs.map((i) => `${i.classReference}:${i.prop}`));
568
+ const missingInputs = defaultGroup.inputs.filter((defaultInput) => !existingProps.has(`${defaultInput.classReference}:${defaultInput.prop}`)).map((defaultInput) => {
569
+ const propDef = require_extension.SUPPORTED_CSS_PROPERTIES[defaultInput.prop];
570
+ if (propDef && propDef.type === "number") return {
571
+ ...defaultInput,
572
+ value: "",
573
+ placeholder: String(propDef.defaultValue)
574
+ };
575
+ return { ...defaultInput };
576
+ });
577
+ if (missingInputs.length === 0) return group;
578
+ return {
579
+ ...group,
580
+ inputs: [...group.inputs, ...missingInputs]
581
+ };
582
+ });
583
+ }
584
+ function applyStyleChange(styles, themeName, { classReference, prop, newValue }) {
585
+ let found = false;
586
+ const updatedStyles = styles.map((styleGroup) => {
587
+ if (styleGroup.inputs.find((input) => input.classReference === classReference && input.prop === prop)) {
588
+ found = true;
589
+ return {
590
+ ...styleGroup,
591
+ inputs: styleGroup.inputs.map((input) => {
592
+ if (input.classReference === classReference && input.prop === prop) return {
593
+ ...input,
594
+ value: newValue
595
+ };
596
+ return input;
597
+ })
598
+ };
599
+ }
600
+ return styleGroup;
601
+ });
602
+ if (found) return updatedStyles;
603
+ const propDef = require_extension.SUPPORTED_CSS_PROPERTIES[prop] ?? null;
604
+ return updatedStyles.map((styleGroup) => {
605
+ if (styleGroup.classReference !== classReference) return styleGroup;
606
+ const defaultInput = require_extension.EDITOR_THEMES[themeName].find((g) => styleGroup.id ? g.id === styleGroup.id : g.title === styleGroup.title)?.inputs.find((i) => i.prop === prop && i.classReference === classReference);
607
+ if (defaultInput) return {
608
+ ...styleGroup,
609
+ inputs: [...styleGroup.inputs, {
610
+ ...defaultInput,
611
+ value: newValue
612
+ }]
613
+ };
614
+ if (propDef) return {
615
+ ...styleGroup,
616
+ inputs: [...styleGroup.inputs, {
617
+ label: propDef.label,
618
+ type: propDef.type,
619
+ value: newValue,
620
+ prop,
621
+ classReference,
622
+ unit: propDef.unit,
623
+ options: propDef.options
624
+ }]
625
+ };
626
+ return styleGroup;
627
+ });
628
+ }
629
+ function InspectorDocument({ children }) {
630
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
631
+ const theming = require_extension.useEmailTheming(editor);
632
+ const { target } = useInspector();
633
+ if (!editor || !theming) return null;
634
+ const themeDefaults = require_extension.EDITOR_THEMES[theming.theme];
635
+ const groups = ensureAllProperties(theming.styles, themeDefaults);
636
+ function setGlobalStyle(classReference, property, value) {
637
+ require_extension.setGlobalStyles(editor, applyStyleChange(theming.styles, theming.theme, {
638
+ classReference,
639
+ prop: property,
640
+ newValue: value
641
+ }));
642
+ }
643
+ function batchSetGlobalStyle(changes) {
644
+ let styles = theming.styles;
645
+ for (const change of changes) styles = applyStyleChange(styles, theming.theme, {
646
+ classReference: change.classReference,
647
+ prop: change.property,
648
+ newValue: change.value
649
+ });
650
+ require_extension.setGlobalStyles(editor, styles);
651
+ }
652
+ function findStyleValue(classReference, prop) {
653
+ for (const group of groups) {
654
+ const input = group.inputs.find((i) => i.classReference === classReference && i.prop === prop);
655
+ if (input) return input.value;
656
+ }
657
+ for (const group of themeDefaults) {
658
+ const input = group.inputs.find((i) => i.classReference === classReference && i.prop === prop);
659
+ if (input) return input.value;
660
+ }
661
+ return require_extension.SUPPORTED_CSS_PROPERTIES[prop]?.defaultValue ?? "";
662
+ }
663
+ if (target === "doc") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({
664
+ styles: groups,
665
+ setGlobalStyle,
666
+ batchSetGlobalStyle,
667
+ findStyleValue
668
+ }) });
669
+ }
670
+
671
+ //#endregion
672
+ //#region src/ui/inspector/index.tsx
673
+ const Inspector = {
674
+ Provider: InspectorProvider,
675
+ Breadcrumb: InspectorBreadcrumb,
676
+ Document: InspectorDocument
677
+ };
678
+
52
679
  //#endregion
53
680
  //#region src/ui/slash-command/index.ts
54
681
  const SlashCommand = {
@@ -58,11 +685,15 @@ const SlashCommand = {
58
685
 
59
686
  //#endregion
60
687
  exports.AlignCenterIcon = require_root.AlignCenterIcon;
688
+ exports.AlignCenterVerticalIcon = AlignCenterVerticalIcon;
689
+ exports.AlignEndVerticalIcon = AlignEndVerticalIcon;
61
690
  exports.AlignLeftIcon = require_root.AlignLeftIcon;
62
691
  exports.AlignRightIcon = require_root.AlignRightIcon;
692
+ exports.AlignStartVerticalIcon = AlignStartVerticalIcon;
63
693
  exports.BULLET_LIST = require_root.BULLET_LIST;
64
694
  exports.BUTTON = require_root.BUTTON;
65
695
  exports.BoldIcon = require_root.BoldIcon;
696
+ exports.BoxIcon = BoxIcon;
66
697
  exports.BubbleMenu = BubbleMenu;
67
698
  exports.BubbleMenuAlignCenter = require_root.BubbleMenuAlignCenter;
68
699
  exports.BubbleMenuAlignLeft = require_root.BubbleMenuAlignLeft;
@@ -111,31 +742,43 @@ exports.H1 = require_root.H1;
111
742
  exports.H2 = require_root.H2;
112
743
  exports.H3 = require_root.H3;
113
744
  exports.Heading1 = require_root.Heading1;
745
+ exports.Heading1Icon = require_root.Heading1;
114
746
  exports.Heading2 = require_root.Heading2;
115
747
  exports.Heading3 = require_root.Heading3;
748
+ exports.ImageIcon = ImageIcon;
749
+ exports.Inspector = Inspector;
116
750
  exports.ItalicIcon = require_root.ItalicIcon;
751
+ exports.LayoutIcon = LayoutIcon;
117
752
  exports.LinkIcon = require_root.LinkIcon;
118
753
  exports.List = require_root.List;
754
+ exports.ListIcon = require_root.List;
119
755
  exports.ListOrdered = require_root.ListOrdered;
756
+ exports.ListOrderedIcon = require_root.ListOrdered;
757
+ exports.MinusIcon = MinusIcon;
120
758
  exports.MousePointer = require_root.MousePointer;
759
+ exports.MousePointerClickIcon = MousePointerClickIcon;
121
760
  exports.NUMBERED_LIST = require_root.NUMBERED_LIST;
122
761
  exports.NodeSelectorContent = require_root.NodeSelectorContent;
123
762
  exports.NodeSelectorRoot = require_root.NodeSelectorRoot;
124
763
  exports.NodeSelectorTrigger = require_root.NodeSelectorTrigger;
125
764
  exports.PencilIcon = require_root.PencilIcon;
126
765
  exports.QUOTE = require_root.QUOTE;
766
+ exports.QuoteIcon = require_root.TextQuote;
127
767
  exports.Rows2 = require_root.Rows2;
128
768
  exports.SECTION = require_root.SECTION;
129
769
  exports.SlashCommand = SlashCommand;
130
770
  exports.SplitSquareVertical = require_root.SplitSquareVertical;
131
771
  exports.SquareCode = require_root.SquareCode;
772
+ exports.SquareRoundCornerIcon = SquareRoundCornerIcon;
132
773
  exports.StrikethroughIcon = require_root.StrikethroughIcon;
133
774
  exports.TEXT = require_root.TEXT;
134
775
  exports.THREE_COLUMNS = require_root.THREE_COLUMNS;
135
776
  exports.TWO_COLUMNS = require_root.TWO_COLUMNS;
777
+ exports.TableIcon = TableIcon;
136
778
  exports.Text = require_root.Text;
137
779
  exports.TextIcon = require_root.TextIcon;
138
780
  exports.TextQuote = require_root.TextQuote;
781
+ exports.TypeIcon = TypeIcon;
139
782
  exports.UnderlineIcon = require_root.UnderlineIcon;
140
783
  exports.UnlinkIcon = require_root.UnlinkIcon;
141
784
  exports.bubbleMenuTriggers = require_root.bubbleMenuTriggers;