@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.mjs CHANGED
@@ -1,6 +1,320 @@
1
- import { $ as BubbleMenuButtonForm, A as BubbleMenuImageEditLink, At as AlignRightIcon, B as BubbleMenuItalic, C as BubbleMenuLinkUnlink, Ct as Columns2, D as BubbleMenuLinkEditLink, Dt as Check, E as BubbleMenuLinkForm, Et as ChevronDown, F as BubbleMenuNodeSelector, G as BubbleMenuAlignLeft, H as BubbleMenuCode, I as NodeSelectorContent, J as BubbleMenuButtonDefault, K as BubbleMenuAlignCenter, L as NodeSelectorRoot, M as BubbleMenuUppercase, Mt as AlignCenterIcon, N as BubbleMenuUnderline, O as BubbleMenuImageDefault, Ot as CaseUpperIcon, P as BubbleMenuStrike, Q as BubbleMenuButtonToolbar, R as NodeSelectorTrigger, S as BubbleMenuLinkDefault, St as Columns3, T as BubbleMenuLinkOpenLink, Tt as CodeIcon, U as BubbleMenuBold, V as BubbleMenuItemGroup, W as BubbleMenuAlignRight, X as bubbleMenuTriggers, Y as BubbleMenuRoot, Z as BubbleMenuButtonUnlink, _ as TWO_COLUMNS, _t as Heading3, a as BUTTON, at as Text, b as isAtMaxColumnsDepth, bt as ExternalLinkIcon, c as FOUR_COLUMNS, ct as SquareCode, d as H3, dt as PencilIcon, et as BubbleMenuButtonEditLink, f as NUMBERED_LIST, ft as MousePointer, g as THREE_COLUMNS, gt as ItalicIcon, h as TEXT, ht as LinkIcon, i as BULLET_LIST, it as TextQuote, j as BubbleMenuDefault, jt as AlignLeftIcon, k as BubbleMenuImageToolbar, kt as BoldIcon, l as H1, lt as SplitSquareVertical, m as SECTION, mt as List, n as filterAndRankItems, nt as UnlinkIcon, o as CODE, ot as TextIcon, p as QUOTE, pt as ListOrdered, q as BubbleMenuItem, r as scoreItem, rt as UnderlineIcon, s as DIVIDER, st as StrikethroughIcon, t as SlashCommandRoot, tt as useBubbleMenuContext, u as H2, ut as Rows2, v as defaultSlashCommands, vt as Heading2, w as BubbleMenuLinkToolbar, wt as Code, x as isInsideNode, xt as Columns4, y as CommandList, yt as Heading1, z as BubbleMenuLinkSelector } from "../root-pS4l8bVZ.mjs";
2
- import { jsx } from "react/jsx-runtime";
1
+ import { d as EDITOR_THEMES, l as useEmailTheming, m as SUPPORTED_CSS_PROPERTIES, s as setGlobalStyles } from "../extension-DcToBuV0.mjs";
2
+ import { $ as BubbleMenuButtonForm, A as BubbleMenuImageEditLink, At as AlignRightIcon, B as BubbleMenuItalic, C as BubbleMenuLinkUnlink, Ct as Columns2, D as BubbleMenuLinkEditLink, Dt as Check, E as BubbleMenuLinkForm, Et as ChevronDown, F as BubbleMenuNodeSelector, G as BubbleMenuAlignLeft, H as BubbleMenuCode, I as NodeSelectorContent, J as BubbleMenuButtonDefault, K as BubbleMenuAlignCenter, L as NodeSelectorRoot, M as BubbleMenuUppercase, Mt as AlignCenterIcon, N as BubbleMenuUnderline, O as BubbleMenuImageDefault, Ot as CaseUpperIcon, P as BubbleMenuStrike, Q as BubbleMenuButtonToolbar, R as NodeSelectorTrigger, S as BubbleMenuLinkDefault, St as Columns3, T as BubbleMenuLinkOpenLink, Tt as CodeIcon, U as BubbleMenuBold, V as BubbleMenuItemGroup, W as BubbleMenuAlignRight, X as bubbleMenuTriggers, Y as BubbleMenuRoot, Z as BubbleMenuButtonUnlink, _ as TWO_COLUMNS, _t as Heading3, a as BUTTON, at as Text, b as isAtMaxColumnsDepth, bt as ExternalLinkIcon, c as FOUR_COLUMNS, ct as SquareCode, d as H3, dt as PencilIcon, et as BubbleMenuButtonEditLink, f as NUMBERED_LIST, ft as MousePointer, g as THREE_COLUMNS, gt as ItalicIcon, h as TEXT, ht as LinkIcon, i as BULLET_LIST, it as TextQuote, j as BubbleMenuDefault, jt as AlignLeftIcon, k as BubbleMenuImageToolbar, kt as BoldIcon, l as H1, lt as SplitSquareVertical, m as SECTION, mt as List, n as filterAndRankItems, nt as UnlinkIcon, o as CODE, ot as TextIcon, p as QUOTE, pt as ListOrdered, q as BubbleMenuItem, r as scoreItem, rt as UnderlineIcon, s as DIVIDER, st as StrikethroughIcon, t as SlashCommandRoot, tt as useBubbleMenuContext, u as H2, ut as Rows2, v as defaultSlashCommands, vt as Heading2, w as BubbleMenuLinkToolbar, wt as Code, x as isInsideNode, xt as Columns4, y as CommandList, yt as Heading1, z as BubbleMenuLinkSelector } from "../root-BVs63m-4.mjs";
3
+ import { useCurrentEditor, useEditorState } from "@tiptap/react";
4
+ import * as React$1 from "react";
5
+ import React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { extensions } from "@tiptap/core";
8
+ import { NodeSelection, Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
3
9
 
10
+ //#region src/ui/icons/align-center-vertical.tsx
11
+ function AlignCenterVerticalIcon({ size, width, height, ...props }) {
12
+ return /* @__PURE__ */ jsxs("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: size ?? width ?? 24,
15
+ height: size ?? height ?? 24,
16
+ viewBox: "0 0 24 24",
17
+ fill: "none",
18
+ stroke: "currentColor",
19
+ strokeWidth: 2,
20
+ strokeLinecap: "round",
21
+ strokeLinejoin: "round",
22
+ "aria-hidden": "true",
23
+ ...props,
24
+ children: [
25
+ /* @__PURE__ */ jsx("path", { d: "M12 2v20" }),
26
+ /* @__PURE__ */ jsx("path", { d: "M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" }),
27
+ /* @__PURE__ */ jsx("path", { d: "M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" }),
28
+ /* @__PURE__ */ jsx("path", { d: "M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" }),
29
+ /* @__PURE__ */ jsx("path", { d: "M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" })
30
+ ]
31
+ });
32
+ }
33
+
34
+ //#endregion
35
+ //#region src/ui/icons/align-end-vertical.tsx
36
+ function AlignEndVerticalIcon({ size, width, height, ...props }) {
37
+ return /* @__PURE__ */ jsxs("svg", {
38
+ xmlns: "http://www.w3.org/2000/svg",
39
+ width: size ?? width ?? 24,
40
+ height: size ?? height ?? 24,
41
+ viewBox: "0 0 24 24",
42
+ fill: "none",
43
+ stroke: "currentColor",
44
+ strokeWidth: 2,
45
+ strokeLinecap: "round",
46
+ strokeLinejoin: "round",
47
+ "aria-hidden": "true",
48
+ ...props,
49
+ children: [
50
+ /* @__PURE__ */ jsx("rect", {
51
+ width: "9",
52
+ height: "6",
53
+ x: "9",
54
+ y: "14",
55
+ rx: "2"
56
+ }),
57
+ /* @__PURE__ */ jsx("rect", {
58
+ width: "16",
59
+ height: "6",
60
+ x: "2",
61
+ y: "4",
62
+ rx: "2"
63
+ }),
64
+ /* @__PURE__ */ jsx("path", { d: "M22 2v20" })
65
+ ]
66
+ });
67
+ }
68
+
69
+ //#endregion
70
+ //#region src/ui/icons/align-start-vertical.tsx
71
+ function AlignStartVerticalIcon({ size, width, height, ...props }) {
72
+ return /* @__PURE__ */ jsxs("svg", {
73
+ xmlns: "http://www.w3.org/2000/svg",
74
+ width: size ?? width ?? 24,
75
+ height: size ?? height ?? 24,
76
+ viewBox: "0 0 24 24",
77
+ fill: "none",
78
+ stroke: "currentColor",
79
+ strokeWidth: 2,
80
+ strokeLinecap: "round",
81
+ strokeLinejoin: "round",
82
+ "aria-hidden": "true",
83
+ ...props,
84
+ children: [
85
+ /* @__PURE__ */ jsx("rect", {
86
+ width: "9",
87
+ height: "6",
88
+ x: "6",
89
+ y: "14",
90
+ rx: "2"
91
+ }),
92
+ /* @__PURE__ */ jsx("rect", {
93
+ width: "16",
94
+ height: "6",
95
+ x: "6",
96
+ y: "4",
97
+ rx: "2"
98
+ }),
99
+ /* @__PURE__ */ jsx("path", { d: "M2 2v20" })
100
+ ]
101
+ });
102
+ }
103
+
104
+ //#endregion
105
+ //#region src/ui/icons/box.tsx
106
+ function BoxIcon({ size, width, height, ...props }) {
107
+ return /* @__PURE__ */ jsxs("svg", {
108
+ xmlns: "http://www.w3.org/2000/svg",
109
+ width: size ?? width ?? 24,
110
+ height: size ?? height ?? 24,
111
+ viewBox: "0 0 24 24",
112
+ fill: "none",
113
+ stroke: "currentColor",
114
+ strokeWidth: 2,
115
+ strokeLinecap: "round",
116
+ strokeLinejoin: "round",
117
+ "aria-hidden": "true",
118
+ ...props,
119
+ children: [
120
+ /* @__PURE__ */ 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" }),
121
+ /* @__PURE__ */ jsx("path", { d: "m3.3 7 8.7 5 8.7-5" }),
122
+ /* @__PURE__ */ jsx("path", { d: "M12 22V12" })
123
+ ]
124
+ });
125
+ }
126
+
127
+ //#endregion
128
+ //#region src/ui/icons/image.tsx
129
+ function ImageIcon({ size, width, height, ...props }) {
130
+ return /* @__PURE__ */ jsxs("svg", {
131
+ xmlns: "http://www.w3.org/2000/svg",
132
+ width: size ?? width ?? 24,
133
+ height: size ?? height ?? 24,
134
+ viewBox: "0 0 24 24",
135
+ fill: "none",
136
+ stroke: "currentColor",
137
+ strokeWidth: 2,
138
+ strokeLinecap: "round",
139
+ strokeLinejoin: "round",
140
+ "aria-hidden": "true",
141
+ ...props,
142
+ children: [
143
+ /* @__PURE__ */ jsx("rect", {
144
+ width: "18",
145
+ height: "18",
146
+ x: "3",
147
+ y: "3",
148
+ rx: "2",
149
+ ry: "2"
150
+ }),
151
+ /* @__PURE__ */ jsx("circle", {
152
+ cx: "9",
153
+ cy: "9",
154
+ r: "2"
155
+ }),
156
+ /* @__PURE__ */ jsx("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
157
+ ]
158
+ });
159
+ }
160
+
161
+ //#endregion
162
+ //#region src/ui/icons/layout.tsx
163
+ function LayoutIcon({ size, width, height, ...props }) {
164
+ return /* @__PURE__ */ jsxs("svg", {
165
+ xmlns: "http://www.w3.org/2000/svg",
166
+ width: size ?? width ?? 24,
167
+ height: size ?? height ?? 24,
168
+ viewBox: "0 0 24 24",
169
+ fill: "none",
170
+ stroke: "currentColor",
171
+ strokeWidth: 2,
172
+ strokeLinecap: "round",
173
+ strokeLinejoin: "round",
174
+ "aria-hidden": "true",
175
+ ...props,
176
+ children: [
177
+ /* @__PURE__ */ jsx("rect", {
178
+ width: "18",
179
+ height: "18",
180
+ x: "3",
181
+ y: "3",
182
+ rx: "2",
183
+ ry: "2"
184
+ }),
185
+ /* @__PURE__ */ jsx("path", { d: "M3 9h18" }),
186
+ /* @__PURE__ */ jsx("path", { d: "M9 21V9" })
187
+ ]
188
+ });
189
+ }
190
+
191
+ //#endregion
192
+ //#region src/ui/icons/minus.tsx
193
+ function MinusIcon({ size, width, height, ...props }) {
194
+ return /* @__PURE__ */ jsx("svg", {
195
+ xmlns: "http://www.w3.org/2000/svg",
196
+ width: size ?? width ?? 24,
197
+ height: size ?? height ?? 24,
198
+ viewBox: "0 0 24 24",
199
+ fill: "none",
200
+ stroke: "currentColor",
201
+ strokeWidth: 2,
202
+ strokeLinecap: "round",
203
+ strokeLinejoin: "round",
204
+ "aria-hidden": "true",
205
+ ...props,
206
+ children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
207
+ });
208
+ }
209
+
210
+ //#endregion
211
+ //#region src/ui/icons/mouse-pointer-click.tsx
212
+ function MousePointerClickIcon({ size, width, height, ...props }) {
213
+ return /* @__PURE__ */ jsxs("svg", {
214
+ xmlns: "http://www.w3.org/2000/svg",
215
+ width: size ?? width ?? 24,
216
+ height: size ?? height ?? 24,
217
+ viewBox: "0 0 24 24",
218
+ fill: "none",
219
+ stroke: "currentColor",
220
+ strokeWidth: 2,
221
+ strokeLinecap: "round",
222
+ strokeLinejoin: "round",
223
+ "aria-hidden": "true",
224
+ ...props,
225
+ children: [
226
+ /* @__PURE__ */ jsx("path", { d: "M14 4.1 12 6" }),
227
+ /* @__PURE__ */ jsx("path", { d: "m5.1 8-2.9-.8" }),
228
+ /* @__PURE__ */ jsx("path", { d: "m6 12-1.9 2" }),
229
+ /* @__PURE__ */ jsx("path", { d: "M7.2 2.2 8 5.1" }),
230
+ /* @__PURE__ */ 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" })
231
+ ]
232
+ });
233
+ }
234
+
235
+ //#endregion
236
+ //#region src/ui/icons/square-round-corner.tsx
237
+ function SquareRoundCornerIcon({ size, width, height, ...props }) {
238
+ return /* @__PURE__ */ jsxs("svg", {
239
+ xmlns: "http://www.w3.org/2000/svg",
240
+ width: size ?? width ?? 24,
241
+ height: size ?? height ?? 24,
242
+ viewBox: "0 0 24 24",
243
+ fill: "none",
244
+ stroke: "currentColor",
245
+ strokeWidth: 2,
246
+ strokeLinecap: "round",
247
+ strokeLinejoin: "round",
248
+ "aria-hidden": "true",
249
+ ...props,
250
+ children: [/* @__PURE__ */ 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__ */ jsx("path", { d: "M14 3a8 8 0 0 1 8 8" })]
251
+ });
252
+ }
253
+
254
+ //#endregion
255
+ //#region src/ui/icons/table.tsx
256
+ function TableIcon({ size, width, height, ...props }) {
257
+ return /* @__PURE__ */ jsxs("svg", {
258
+ xmlns: "http://www.w3.org/2000/svg",
259
+ width: size ?? width ?? 24,
260
+ height: size ?? height ?? 24,
261
+ viewBox: "0 0 24 24",
262
+ fill: "none",
263
+ stroke: "currentColor",
264
+ strokeWidth: 2,
265
+ strokeLinecap: "round",
266
+ strokeLinejoin: "round",
267
+ "aria-hidden": "true",
268
+ ...props,
269
+ children: [
270
+ /* @__PURE__ */ jsx("path", { d: "M12 3v18" }),
271
+ /* @__PURE__ */ jsx("rect", {
272
+ width: "18",
273
+ height: "18",
274
+ x: "3",
275
+ y: "3",
276
+ rx: "2"
277
+ }),
278
+ /* @__PURE__ */ jsx("path", { d: "M3 9h18" }),
279
+ /* @__PURE__ */ jsx("path", { d: "M3 15h18" })
280
+ ]
281
+ });
282
+ }
283
+
284
+ //#endregion
285
+ //#region src/ui/icons/type.tsx
286
+ function TypeIcon({ size, width, height, ...props }) {
287
+ return /* @__PURE__ */ jsxs("svg", {
288
+ xmlns: "http://www.w3.org/2000/svg",
289
+ width: size ?? width ?? 24,
290
+ height: size ?? height ?? 24,
291
+ viewBox: "0 0 24 24",
292
+ fill: "none",
293
+ stroke: "currentColor",
294
+ strokeWidth: 2,
295
+ strokeLinecap: "round",
296
+ strokeLinejoin: "round",
297
+ "aria-hidden": "true",
298
+ ...props,
299
+ children: [
300
+ /* @__PURE__ */ jsx("polyline", { points: "4 7 4 4 20 4 20 7" }),
301
+ /* @__PURE__ */ jsx("line", {
302
+ x1: "9",
303
+ x2: "15",
304
+ y1: "20",
305
+ y2: "20"
306
+ }),
307
+ /* @__PURE__ */ jsx("line", {
308
+ x1: "12",
309
+ x2: "12",
310
+ y1: "4",
311
+ y2: "20"
312
+ })
313
+ ]
314
+ });
315
+ }
316
+
317
+ //#endregion
4
318
  //#region src/ui/bubble-menu/separator.tsx
5
319
  function BubbleMenuSeparator({ className }) {
6
320
  return /* @__PURE__ */ jsx("hr", {
@@ -48,6 +362,319 @@ const BubbleMenu = {
48
362
  ImageDefault: BubbleMenuImageDefault
49
363
  };
50
364
 
365
+ //#endregion
366
+ //#region src/ui/inspector/provider.tsx
367
+ const IGNORED_NODES = ["doc", "text"];
368
+ function getHierarchyAtPosition(editor, pos) {
369
+ if (!editor) return [];
370
+ const { doc } = editor.state;
371
+ const hierarchy = [];
372
+ const nodeAtPos = doc.nodeAt(pos);
373
+ if (nodeAtPos && !IGNORED_NODES.includes(nodeAtPos.type.name)) hierarchy.push({
374
+ nodeType: nodeAtPos.type.name,
375
+ nodeAttrs: { ...nodeAtPos.attrs },
376
+ nodePos: {
377
+ pos,
378
+ inside: pos
379
+ }
380
+ });
381
+ const resolvedPos = doc.resolve(pos);
382
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
383
+ const node = resolvedPos.node(depth);
384
+ const nodePos = resolvedPos.before(depth);
385
+ if (node && !IGNORED_NODES.includes(node.type.name)) {
386
+ if (!hierarchy.some((h) => h.nodePos.pos === nodePos)) hierarchy.push({
387
+ nodeType: node.type.name,
388
+ nodeAttrs: { ...node.attrs },
389
+ nodePos: {
390
+ pos: nodePos,
391
+ inside: nodePos
392
+ }
393
+ });
394
+ }
395
+ }
396
+ return hierarchy;
397
+ }
398
+ function getNodeHierarchy(editor) {
399
+ if (!editor) return [];
400
+ const { selection } = editor.state;
401
+ const hierarchy = [];
402
+ if (selection instanceof NodeSelection) {
403
+ const node = selection.node;
404
+ if (node && !IGNORED_NODES.includes(node.type.name)) hierarchy.push({
405
+ nodeType: node.type.name,
406
+ nodeAttrs: { ...node.attrs },
407
+ nodePos: {
408
+ pos: selection.from,
409
+ inside: selection.from
410
+ }
411
+ });
412
+ }
413
+ const { from } = selection;
414
+ const resolvedPos = editor.state.doc.resolve(from);
415
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
416
+ const node = resolvedPos.node(depth);
417
+ const pos = resolvedPos.before(depth);
418
+ if (node && !IGNORED_NODES.includes(node.type.name)) {
419
+ if (!hierarchy.some((h) => h.nodePos.pos === pos)) hierarchy.push({
420
+ nodeType: node.type.name,
421
+ nodeAttrs: { ...node.attrs },
422
+ nodePos: {
423
+ pos,
424
+ inside: pos
425
+ }
426
+ });
427
+ }
428
+ }
429
+ return hierarchy;
430
+ }
431
+ const InspectorContext = React$1.createContext(null);
432
+ function useInspector() {
433
+ const context = React$1.useContext(InspectorContext);
434
+ if (!context) throw new Error("useInspector can only be called from inside the InspectorContext. This probably means you forgot the <Inspector.Provider>");
435
+ return context;
436
+ }
437
+ function InspectorProvider({ children }) {
438
+ const { editor } = useCurrentEditor();
439
+ const target = useEditorState({
440
+ editor,
441
+ selector(context) {
442
+ if (!context.editor) return null;
443
+ if (!context.editor.isFocused) return "doc";
444
+ const { selection } = context.editor.state;
445
+ if (selection.content().size > 0 && selection instanceof TextSelection) {
446
+ const { $from } = selection;
447
+ for (let depth = $from.depth; depth > 0; depth--) if ($from.node(depth).type.name === "button") {
448
+ const pos = $from.before(depth);
449
+ const node = context.editor.state.doc.nodeAt(pos);
450
+ if (node) return {
451
+ nodeType: "button",
452
+ nodeAttrs: { ...node.attrs },
453
+ nodePos: {
454
+ pos,
455
+ inside: pos
456
+ }
457
+ };
458
+ break;
459
+ }
460
+ return "text";
461
+ }
462
+ const hierarchy = getNodeHierarchy(context.editor);
463
+ if (hierarchy.length > 0) {
464
+ const innermost = hierarchy[0];
465
+ const columnEntry = hierarchy.find((h) => h.nodeType === "columnsColumn");
466
+ return columnEntry && innermost.nodeType === "paragraph" ? columnEntry : innermost;
467
+ }
468
+ return "doc";
469
+ }
470
+ });
471
+ const pathFromRoot = React$1.useMemo(() => {
472
+ if (!editor) return [];
473
+ if (typeof target === "object" && target) {
474
+ const path = [...getHierarchyAtPosition(editor, target.nodePos.pos)].reverse();
475
+ return path.length > 0 ? path : [target];
476
+ }
477
+ if (target === "text") return [...getNodeHierarchy(editor)].reverse();
478
+ return [];
479
+ }, [editor, target]);
480
+ const editorDomFocused = React$1.useRef(false);
481
+ const inspectorFocused = React$1.useRef(false);
482
+ React$1.useEffect(() => {
483
+ const defaultFocusPlugin = editor?.state.plugins.find((plugin) => plugin.spec.key === extensions.focusEventsPluginKey);
484
+ if (editor && defaultFocusPlugin) {
485
+ editor?.unregisterPlugin(extensions.focusEventsPluginKey);
486
+ const pluginKey = new PluginKey("inspectorReactEmailFocusEvents");
487
+ editor.registerPlugin(new Plugin({
488
+ key: pluginKey,
489
+ props: { handleDOMEvents: {
490
+ focus: (view, event) => {
491
+ editorDomFocused.current = true;
492
+ editor.isFocused = true;
493
+ const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
494
+ view.dispatch(transaction);
495
+ return false;
496
+ },
497
+ blur: (view, event) => {
498
+ editorDomFocused.current = false;
499
+ if (!inspectorFocused.current) {
500
+ editor.isFocused = false;
501
+ const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
502
+ view.dispatch(transaction);
503
+ }
504
+ return false;
505
+ }
506
+ } }
507
+ }));
508
+ return () => {
509
+ editor?.unregisterPlugin(pluginKey);
510
+ editor?.registerPlugin(defaultFocusPlugin);
511
+ };
512
+ }
513
+ }, [editor]);
514
+ return /* @__PURE__ */ jsx(InspectorContext.Provider, {
515
+ value: {
516
+ target,
517
+ pathFromRoot,
518
+ focus: (event) => {
519
+ inspectorFocused.current = true;
520
+ if (editor) {
521
+ editor.isFocused = true;
522
+ const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
523
+ editor.view.dispatch(transaction);
524
+ }
525
+ },
526
+ blur: (event) => {
527
+ inspectorFocused.current = false;
528
+ if (!editorDomFocused.current && editor) {
529
+ editor.isFocused = false;
530
+ const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
531
+ editor.view.dispatch(transaction);
532
+ }
533
+ }
534
+ },
535
+ children
536
+ });
537
+ }
538
+
539
+ //#endregion
540
+ //#region src/ui/inspector/breadcrumb.tsx
541
+ function InspectorBreadcrumb({ children }) {
542
+ const { editor } = useCurrentEditor();
543
+ const { pathFromRoot } = useInspector();
544
+ return children(React.useMemo(() => {
545
+ return [{
546
+ node: null,
547
+ focus() {
548
+ editor?.commands.setTextSelection(0);
549
+ }
550
+ }, ...pathFromRoot.map((focusedNode) => ({
551
+ node: focusedNode,
552
+ focus() {
553
+ editor?.commands.setNodeSelection(focusedNode.nodePos.pos);
554
+ editor?.commands.focus();
555
+ }
556
+ }))];
557
+ }, [pathFromRoot]));
558
+ }
559
+
560
+ //#endregion
561
+ //#region src/ui/inspector/document.tsx
562
+ function ensureAllProperties(currentStyles, themeDefaults) {
563
+ return currentStyles.map((group) => {
564
+ const defaultGroup = themeDefaults.find((g) => group.id ? g.id === group.id : g.title === group.title);
565
+ if (!defaultGroup || defaultGroup.inputs.length === 0) return group;
566
+ const existingProps = new Set(group.inputs.map((i) => `${i.classReference}:${i.prop}`));
567
+ const missingInputs = defaultGroup.inputs.filter((defaultInput) => !existingProps.has(`${defaultInput.classReference}:${defaultInput.prop}`)).map((defaultInput) => {
568
+ const propDef = SUPPORTED_CSS_PROPERTIES[defaultInput.prop];
569
+ if (propDef && propDef.type === "number") return {
570
+ ...defaultInput,
571
+ value: "",
572
+ placeholder: String(propDef.defaultValue)
573
+ };
574
+ return { ...defaultInput };
575
+ });
576
+ if (missingInputs.length === 0) return group;
577
+ return {
578
+ ...group,
579
+ inputs: [...group.inputs, ...missingInputs]
580
+ };
581
+ });
582
+ }
583
+ function applyStyleChange(styles, themeName, { classReference, prop, newValue }) {
584
+ let found = false;
585
+ const updatedStyles = styles.map((styleGroup) => {
586
+ if (styleGroup.inputs.find((input) => input.classReference === classReference && input.prop === prop)) {
587
+ found = true;
588
+ return {
589
+ ...styleGroup,
590
+ inputs: styleGroup.inputs.map((input) => {
591
+ if (input.classReference === classReference && input.prop === prop) return {
592
+ ...input,
593
+ value: newValue
594
+ };
595
+ return input;
596
+ })
597
+ };
598
+ }
599
+ return styleGroup;
600
+ });
601
+ if (found) return updatedStyles;
602
+ const propDef = SUPPORTED_CSS_PROPERTIES[prop] ?? null;
603
+ return updatedStyles.map((styleGroup) => {
604
+ if (styleGroup.classReference !== classReference) return styleGroup;
605
+ const defaultInput = EDITOR_THEMES[themeName].find((g) => styleGroup.id ? g.id === styleGroup.id : g.title === styleGroup.title)?.inputs.find((i) => i.prop === prop && i.classReference === classReference);
606
+ if (defaultInput) return {
607
+ ...styleGroup,
608
+ inputs: [...styleGroup.inputs, {
609
+ ...defaultInput,
610
+ value: newValue
611
+ }]
612
+ };
613
+ if (propDef) return {
614
+ ...styleGroup,
615
+ inputs: [...styleGroup.inputs, {
616
+ label: propDef.label,
617
+ type: propDef.type,
618
+ value: newValue,
619
+ prop,
620
+ classReference,
621
+ unit: propDef.unit,
622
+ options: propDef.options
623
+ }]
624
+ };
625
+ return styleGroup;
626
+ });
627
+ }
628
+ function InspectorDocument({ children }) {
629
+ const { editor } = useCurrentEditor();
630
+ const theming = useEmailTheming(editor);
631
+ const { target } = useInspector();
632
+ if (!editor || !theming) return null;
633
+ const themeDefaults = EDITOR_THEMES[theming.theme];
634
+ const groups = ensureAllProperties(theming.styles, themeDefaults);
635
+ function setGlobalStyle(classReference, property, value) {
636
+ setGlobalStyles(editor, applyStyleChange(theming.styles, theming.theme, {
637
+ classReference,
638
+ prop: property,
639
+ newValue: value
640
+ }));
641
+ }
642
+ function batchSetGlobalStyle(changes) {
643
+ let styles = theming.styles;
644
+ for (const change of changes) styles = applyStyleChange(styles, theming.theme, {
645
+ classReference: change.classReference,
646
+ prop: change.property,
647
+ newValue: change.value
648
+ });
649
+ setGlobalStyles(editor, styles);
650
+ }
651
+ function findStyleValue(classReference, prop) {
652
+ for (const group of groups) {
653
+ const input = group.inputs.find((i) => i.classReference === classReference && i.prop === prop);
654
+ if (input) return input.value;
655
+ }
656
+ for (const group of themeDefaults) {
657
+ const input = group.inputs.find((i) => i.classReference === classReference && i.prop === prop);
658
+ if (input) return input.value;
659
+ }
660
+ return SUPPORTED_CSS_PROPERTIES[prop]?.defaultValue ?? "";
661
+ }
662
+ if (target === "doc") return /* @__PURE__ */ jsx(Fragment, { children: children({
663
+ styles: groups,
664
+ setGlobalStyle,
665
+ batchSetGlobalStyle,
666
+ findStyleValue
667
+ }) });
668
+ }
669
+
670
+ //#endregion
671
+ //#region src/ui/inspector/index.tsx
672
+ const Inspector = {
673
+ Provider: InspectorProvider,
674
+ Breadcrumb: InspectorBreadcrumb,
675
+ Document: InspectorDocument
676
+ };
677
+
51
678
  //#endregion
52
679
  //#region src/ui/slash-command/index.ts
53
680
  const SlashCommand = {
@@ -56,5 +683,5 @@ const SlashCommand = {
56
683
  };
57
684
 
58
685
  //#endregion
59
- export { AlignCenterIcon, AlignLeftIcon, AlignRightIcon, BULLET_LIST, BUTTON, BoldIcon, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuButtonDefault, BubbleMenuButtonEditLink, BubbleMenuButtonForm, BubbleMenuButtonToolbar, BubbleMenuButtonUnlink, BubbleMenuCode, BubbleMenuDefault, BubbleMenuImageDefault, BubbleMenuImageEditLink, BubbleMenuImageToolbar, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkDefault, BubbleMenuLinkEditLink, BubbleMenuLinkForm, BubbleMenuLinkOpenLink, BubbleMenuLinkSelector, BubbleMenuLinkToolbar, BubbleMenuLinkUnlink, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, CODE, CaseUpperIcon, Check, ChevronDown, Code, CodeIcon, Columns2, Columns3, Columns4, CommandList, DIVIDER, ExternalLinkIcon, FOUR_COLUMNS, H1, H2, H3, Heading1, Heading2, Heading3, ItalicIcon, LinkIcon, List, ListOrdered, MousePointer, NUMBERED_LIST, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, PencilIcon, QUOTE, Rows2, SECTION, SlashCommand, SplitSquareVertical, SquareCode, StrikethroughIcon, TEXT, THREE_COLUMNS, TWO_COLUMNS, Text, TextIcon, TextQuote, UnderlineIcon, UnlinkIcon, bubbleMenuTriggers, defaultSlashCommands, filterAndRankItems, isAtMaxColumnsDepth, isInsideNode, scoreItem, useBubbleMenuContext };
686
+ export { AlignCenterIcon, AlignCenterVerticalIcon, AlignEndVerticalIcon, AlignLeftIcon, AlignRightIcon, AlignStartVerticalIcon, BULLET_LIST, BUTTON, BoldIcon, BoxIcon, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuButtonDefault, BubbleMenuButtonEditLink, BubbleMenuButtonForm, BubbleMenuButtonToolbar, BubbleMenuButtonUnlink, BubbleMenuCode, BubbleMenuDefault, BubbleMenuImageDefault, BubbleMenuImageEditLink, BubbleMenuImageToolbar, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkDefault, BubbleMenuLinkEditLink, BubbleMenuLinkForm, BubbleMenuLinkOpenLink, BubbleMenuLinkSelector, BubbleMenuLinkToolbar, BubbleMenuLinkUnlink, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, CODE, CaseUpperIcon, Check, ChevronDown, Code, CodeIcon, Columns2, Columns3, Columns4, CommandList, DIVIDER, ExternalLinkIcon, FOUR_COLUMNS, H1, H2, H3, Heading1, Heading1 as Heading1Icon, Heading2, Heading3, ImageIcon, Inspector, ItalicIcon, LayoutIcon, LinkIcon, List, List as ListIcon, ListOrdered, ListOrdered as ListOrderedIcon, MinusIcon, MousePointer, MousePointerClickIcon, NUMBERED_LIST, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, PencilIcon, QUOTE, TextQuote as QuoteIcon, TextQuote, Rows2, SECTION, SlashCommand, SplitSquareVertical, SquareCode, SquareRoundCornerIcon, StrikethroughIcon, TEXT, THREE_COLUMNS, TWO_COLUMNS, TableIcon, Text, TextIcon, TypeIcon, UnderlineIcon, UnlinkIcon, bubbleMenuTriggers, defaultSlashCommands, filterAndRankItems, isAtMaxColumnsDepth, isInsideNode, scoreItem, useBubbleMenuContext };
60
687
  //# sourceMappingURL=index.mjs.map