@react-email/editor 0.0.0-experimental.7 → 1.0.0-canary.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/columns-BItFgD76.mjs +273 -0
  2. package/dist/columns-BItFgD76.mjs.map +1 -0
  3. package/dist/columns-DqFvXgmK.cjs +394 -0
  4. package/dist/core/index.cjs +10 -0
  5. package/dist/core/index.d.cts +2 -0
  6. package/dist/core/index.d.mts +2 -0
  7. package/dist/core/index.mjs +4 -0
  8. package/dist/core-CbSTyrV4.mjs +151 -0
  9. package/dist/core-CbSTyrV4.mjs.map +1 -0
  10. package/dist/core-D7AzzMLI.cjs +167 -0
  11. package/dist/email-node-B-_g4X-S.mjs +254 -0
  12. package/dist/email-node-B-_g4X-S.mjs.map +1 -0
  13. package/dist/email-node-hLU5bGnX.cjs +288 -0
  14. package/dist/event-bus-CIJ___tH.cjs +65 -0
  15. package/dist/event-bus-CqrIUE24.mjs +55 -0
  16. package/dist/event-bus-CqrIUE24.mjs.map +1 -0
  17. package/dist/extension-BbjpP9mF.cjs +1625 -0
  18. package/dist/extension-C5qNDPZL.mjs +154 -0
  19. package/dist/extension-C5qNDPZL.mjs.map +1 -0
  20. package/dist/extension-Cs4Yq2gF.cjs +158 -0
  21. package/dist/extension-DlWknmE5.mjs +1495 -0
  22. package/dist/extension-DlWknmE5.mjs.map +1 -0
  23. package/dist/extensions/index.cjs +50 -0
  24. package/dist/extensions/index.d.cts +392 -0
  25. package/dist/extensions/index.d.cts.map +1 -0
  26. package/dist/extensions/index.d.mts +392 -0
  27. package/dist/extensions/index.d.mts.map +1 -0
  28. package/dist/extensions/index.mjs +4 -0
  29. package/dist/extensions-CHIQO3d-.mjs +1745 -0
  30. package/dist/extensions-CHIQO3d-.mjs.map +1 -0
  31. package/dist/extensions-DCrDvZ42.cjs +1981 -0
  32. package/dist/global-content-0-J-Te3N.mjs +77 -0
  33. package/dist/global-content-0-J-Te3N.mjs.map +1 -0
  34. package/dist/global-content-8M2KyrOL.cjs +87 -0
  35. package/dist/image-KwEYzhji.cjs +41 -0
  36. package/dist/image-Oc789YjV.mjs +37 -0
  37. package/dist/image-Oc789YjV.mjs.map +1 -0
  38. package/dist/index-CHAPu71g.d.cts +193 -0
  39. package/dist/index-CHAPu71g.d.cts.map +1 -0
  40. package/dist/index-D4UEWmJX.d.mts +193 -0
  41. package/dist/index-D4UEWmJX.d.mts.map +1 -0
  42. package/dist/index.cjs +216 -0
  43. package/dist/index.d.cts +38 -0
  44. package/dist/index.d.cts.map +1 -0
  45. package/dist/index.d.mts +33 -626
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +189 -2228
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/plugins/index.cjs +56 -0
  50. package/dist/plugins/index.d.cts +114 -0
  51. package/dist/plugins/index.d.cts.map +1 -0
  52. package/dist/plugins/index.d.mts +114 -0
  53. package/dist/plugins/index.d.mts.map +1 -0
  54. package/dist/plugins/index.mjs +34 -0
  55. package/dist/plugins/index.mjs.map +1 -0
  56. package/dist/root-CT5d4CKj.cjs +2798 -0
  57. package/dist/root-uvdshbyT.mjs +2295 -0
  58. package/dist/root-uvdshbyT.mjs.map +1 -0
  59. package/dist/set-text-alignment-BCRnE5So.mjs +19 -0
  60. package/dist/set-text-alignment-BCRnE5So.mjs.map +1 -0
  61. package/dist/set-text-alignment-Twg1EG4-.cjs +22 -0
  62. package/dist/style.css +974 -0
  63. package/dist/types-BG5XsXt9.d.mts +37 -0
  64. package/dist/types-BG5XsXt9.d.mts.map +1 -0
  65. package/dist/types-DnOcnDoO.d.mts +56 -0
  66. package/dist/types-DnOcnDoO.d.mts.map +1 -0
  67. package/dist/types-DzPTbbDC.d.cts +56 -0
  68. package/dist/types-DzPTbbDC.d.cts.map +1 -0
  69. package/dist/types-hURXpEIO.d.cts +37 -0
  70. package/dist/types-hURXpEIO.d.cts.map +1 -0
  71. package/dist/ui/bubble-menu/bubble-menu.css +291 -0
  72. package/dist/ui/index.cjs +2895 -0
  73. package/dist/ui/index.d.cts +1155 -0
  74. package/dist/ui/index.d.cts.map +1 -0
  75. package/dist/ui/index.d.mts +1157 -0
  76. package/dist/ui/index.d.mts.map +1 -0
  77. package/dist/ui/index.mjs +2784 -0
  78. package/dist/ui/index.mjs.map +1 -0
  79. package/dist/ui/inspector/inspector.css +293 -0
  80. package/dist/ui/slash-command/slash-command.css +44 -0
  81. package/dist/ui/themes/default.css +1140 -0
  82. package/dist/utils/index.cjs +3 -0
  83. package/dist/utils/index.d.cts +7 -0
  84. package/dist/utils/index.d.cts.map +1 -0
  85. package/dist/utils/index.d.mts +7 -0
  86. package/dist/utils/index.d.mts.map +1 -0
  87. package/dist/utils/index.mjs +2 -0
  88. package/package.json +100 -16
  89. package/readme.md +69 -0
  90. package/dist/index.d.ts +0 -631
  91. package/dist/index.d.ts.map +0 -1
  92. package/dist/index.js +0 -2338
@@ -0,0 +1,2895 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_columns = require("../columns-DqFvXgmK.cjs");
3
+ const require_email_node = require("../email-node-hLU5bGnX.cjs");
4
+ const require_extension = require("../extension-BbjpP9mF.cjs");
5
+ const require_root = require("../root-CT5d4CKj.cjs");
6
+ const require_image = require("../image-KwEYzhji.cjs");
7
+ let _tiptap_react = require("@tiptap/react");
8
+ let react = require("react");
9
+ react = require_columns.__toESM(react);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ let _tiptap_pm_state = require("@tiptap/pm/state");
12
+ let _radix_ui_react_slot = require("@radix-ui/react-slot");
13
+ //#region src/ui/icons/align-center-vertical.tsx
14
+ function AlignCenterVerticalIcon({ size, width, height, ...props }) {
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
16
+ xmlns: "http://www.w3.org/2000/svg",
17
+ width: size ?? width ?? 24,
18
+ height: size ?? height ?? 24,
19
+ viewBox: "0 0 24 24",
20
+ fill: "none",
21
+ stroke: "currentColor",
22
+ strokeWidth: 2,
23
+ strokeLinecap: "round",
24
+ strokeLinejoin: "round",
25
+ "aria-hidden": "true",
26
+ ...props,
27
+ children: [
28
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 2v20" }),
29
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" }),
30
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" }),
31
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" }),
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" })
33
+ ]
34
+ });
35
+ }
36
+ //#endregion
37
+ //#region src/ui/icons/align-end-vertical.tsx
38
+ function AlignEndVerticalIcon({ size, width, height, ...props }) {
39
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
40
+ xmlns: "http://www.w3.org/2000/svg",
41
+ width: size ?? width ?? 24,
42
+ height: size ?? height ?? 24,
43
+ viewBox: "0 0 24 24",
44
+ fill: "none",
45
+ stroke: "currentColor",
46
+ strokeWidth: 2,
47
+ strokeLinecap: "round",
48
+ strokeLinejoin: "round",
49
+ "aria-hidden": "true",
50
+ ...props,
51
+ children: [
52
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
53
+ width: "9",
54
+ height: "6",
55
+ x: "9",
56
+ y: "14",
57
+ rx: "2"
58
+ }),
59
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
60
+ width: "16",
61
+ height: "6",
62
+ x: "2",
63
+ y: "4",
64
+ rx: "2"
65
+ }),
66
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M22 2v20" })
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
+ //#endregion
105
+ //#region src/ui/icons/box.tsx
106
+ function BoxIcon({ size, width, height, ...props }) {
107
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
108
+ xmlns: "http://www.w3.org/2000/svg",
109
+ width: size ?? width ?? 24,
110
+ height: size ?? height ?? 24,
111
+ viewBox: "0 0 24 24",
112
+ fill: "none",
113
+ stroke: "currentColor",
114
+ strokeWidth: 2,
115
+ strokeLinecap: "round",
116
+ strokeLinejoin: "round",
117
+ "aria-hidden": "true",
118
+ ...props,
119
+ children: [
120
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "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__ */ (0, react_jsx_runtime.jsx)("path", { d: "m3.3 7 8.7 5 8.7-5" }),
122
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 22V12" })
123
+ ]
124
+ });
125
+ }
126
+ //#endregion
127
+ //#region src/ui/icons/corner-bottom-left.tsx
128
+ function CornerBottomLeftIcon({ 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 ?? 15,
132
+ height: size ?? height ?? 15,
133
+ viewBox: "0 0 15 15",
134
+ fill: "none",
135
+ "aria-hidden": "true",
136
+ ...props,
137
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
138
+ d: "M9.87737 12H9.9H11.5C11.7761 12 12 11.7761 12 11.5C12 11.2239 11.7761 11 11.5 11H9.9C8.77164 11 7.95545 10.9996 7.31352 10.9472C6.67744 10.8952 6.25662 10.7946 5.91103 10.6185C5.25247 10.283 4.71703 9.74753 4.38148 9.08897C4.20539 8.74338 4.10481 8.32256 4.05284 7.68648C4.00039 7.04455 4 6.22836 4 5.1V3.5C4 3.22386 3.77614 3 3.5 3C3.22386 3 3 3.22386 3 3.5V5.1V5.12263C3 6.22359 3 7.08052 3.05616 7.76791C3.11318 8.46584 3.23058 9.0329 3.49047 9.54296C3.9219 10.3897 4.61031 11.0781 5.45704 11.5095C5.9671 11.7694 6.53416 11.8868 7.23209 11.9438C7.91948 12 8.77641 12 9.87737 12Z",
139
+ fill: "currentColor",
140
+ fillRule: "evenodd",
141
+ clipRule: "evenodd"
142
+ })
143
+ });
144
+ }
145
+ //#endregion
146
+ //#region src/ui/icons/corner-bottom-right.tsx
147
+ function CornerBottomRightIcon({ 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 ?? 15,
151
+ height: size ?? height ?? 15,
152
+ viewBox: "0 0 15 15",
153
+ fill: "none",
154
+ "aria-hidden": "true",
155
+ ...props,
156
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
157
+ d: "M5.12263 12H5.1H3.5C3.22386 12 3 11.7761 3 11.5C3 11.2239 3.22386 11 3.5 11H5.1C6.22836 11 7.04455 10.9996 7.68648 10.9472C8.32256 10.8952 8.74338 10.7946 9.08897 10.6185C9.74753 10.283 10.283 9.74753 10.6185 9.08897C10.7946 8.74338 10.8952 8.32256 10.9472 7.68648C10.9996 7.04455 11 6.22836 11 5.1V3.5C11 3.22386 11.2239 3 11.5 3C11.7761 3 12 3.22386 12 3.5V5.1V5.12263C12 6.22359 12 7.08052 11.9438 7.76791C11.8868 8.46584 11.7694 9.0329 11.5095 9.54296C11.0781 10.3897 10.3897 11.0781 9.54296 11.5095C9.0329 11.7694 8.46584 11.8868 7.76791 11.9438C7.08052 12 6.22359 12 5.12263 12Z",
158
+ fill: "currentColor",
159
+ fillRule: "evenodd",
160
+ clipRule: "evenodd"
161
+ })
162
+ });
163
+ }
164
+ //#endregion
165
+ //#region src/ui/icons/corner-top-left.tsx
166
+ function CornerTopLeftIcon({ size, width, height, ...props }) {
167
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
168
+ xmlns: "http://www.w3.org/2000/svg",
169
+ width: size ?? width ?? 15,
170
+ height: size ?? height ?? 15,
171
+ viewBox: "0 0 15 15",
172
+ fill: "none",
173
+ "aria-hidden": "true",
174
+ ...props,
175
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
176
+ d: "M9.87737 3H9.9H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H9.9C8.77164 4 7.95545 4.00039 7.31352 4.05284C6.67744 4.10481 6.25662 4.20539 5.91103 4.38148C5.25247 4.71703 4.71703 5.25247 4.38148 5.91103C4.20539 6.25662 4.10481 6.67744 4.05284 7.31352C4.00039 7.95545 4 8.77164 4 9.9V11.5C4 11.7761 3.77614 12 3.5 12C3.22386 12 3 11.7761 3 11.5V9.9V9.87737C3 8.77641 3 7.91948 3.05616 7.23209C3.11318 6.53416 3.23058 5.9671 3.49047 5.45704C3.9219 4.61031 4.61031 3.9219 5.45704 3.49047C5.9671 3.23058 6.53416 3.11318 7.23209 3.05616C7.91948 3 8.77641 3 9.87737 3Z",
177
+ fill: "currentColor",
178
+ fillRule: "evenodd",
179
+ clipRule: "evenodd"
180
+ })
181
+ });
182
+ }
183
+ //#endregion
184
+ //#region src/ui/icons/corner-top-right.tsx
185
+ function CornerTopRightIcon({ size, width, height, ...props }) {
186
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
187
+ xmlns: "http://www.w3.org/2000/svg",
188
+ width: size ?? width ?? 15,
189
+ height: size ?? height ?? 15,
190
+ viewBox: "0 0 15 15",
191
+ fill: "none",
192
+ "aria-hidden": "true",
193
+ ...props,
194
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
195
+ d: "M5.12263 3H5.1H3.5C3.22386 3 3 3.22386 3 3.5C3 3.77614 3.22386 4 3.5 4H5.1C6.22836 4 7.04455 4.00039 7.68648 4.05284C8.32256 4.10481 8.74338 4.20539 9.08897 4.38148C9.74753 4.71703 10.283 5.25247 10.6185 5.91103C10.7946 6.25662 10.8952 6.67744 10.9472 7.31352C10.9996 7.95545 11 8.77164 11 9.9V11.5C11 11.7761 11.2239 12 11.5 12C11.7761 12 12 11.7761 12 11.5V9.9V9.87737C12 8.77641 12 7.91948 11.9438 7.23209C11.8868 6.53416 11.7694 5.9671 11.5095 5.45704C11.0781 4.61031 10.3897 3.9219 9.54296 3.49047C9.0329 3.23058 8.46584 3.11318 7.76791 3.05616C7.08052 3 6.22359 3 5.12263 3Z",
196
+ fill: "currentColor",
197
+ fillRule: "evenodd",
198
+ clipRule: "evenodd"
199
+ })
200
+ });
201
+ }
202
+ //#endregion
203
+ //#region src/ui/icons/layout.tsx
204
+ function LayoutIcon({ size, width, height, ...props }) {
205
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
206
+ xmlns: "http://www.w3.org/2000/svg",
207
+ width: size ?? width ?? 24,
208
+ height: size ?? height ?? 24,
209
+ viewBox: "0 0 24 24",
210
+ fill: "none",
211
+ stroke: "currentColor",
212
+ strokeWidth: 2,
213
+ strokeLinecap: "round",
214
+ strokeLinejoin: "round",
215
+ "aria-hidden": "true",
216
+ ...props,
217
+ children: [
218
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
219
+ width: "18",
220
+ height: "18",
221
+ x: "3",
222
+ y: "3",
223
+ rx: "2",
224
+ ry: "2"
225
+ }),
226
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 9h18" }),
227
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 21V9" })
228
+ ]
229
+ });
230
+ }
231
+ //#endregion
232
+ //#region src/ui/icons/minus.tsx
233
+ function MinusIcon({ size, width, height, ...props }) {
234
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
235
+ xmlns: "http://www.w3.org/2000/svg",
236
+ width: size ?? width ?? 24,
237
+ height: size ?? height ?? 24,
238
+ viewBox: "0 0 24 24",
239
+ fill: "none",
240
+ stroke: "currentColor",
241
+ strokeWidth: 2,
242
+ strokeLinecap: "round",
243
+ strokeLinejoin: "round",
244
+ "aria-hidden": "true",
245
+ ...props,
246
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" })
247
+ });
248
+ }
249
+ //#endregion
250
+ //#region src/ui/icons/mouse-pointer-click.tsx
251
+ function MousePointerClickIcon({ size, width, height, ...props }) {
252
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
253
+ xmlns: "http://www.w3.org/2000/svg",
254
+ width: size ?? width ?? 24,
255
+ height: size ?? height ?? 24,
256
+ viewBox: "0 0 24 24",
257
+ fill: "none",
258
+ stroke: "currentColor",
259
+ strokeWidth: 2,
260
+ strokeLinecap: "round",
261
+ strokeLinejoin: "round",
262
+ "aria-hidden": "true",
263
+ ...props,
264
+ children: [
265
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 4.1 12 6" }),
266
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m5.1 8-2.9-.8" }),
267
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 12-1.9 2" }),
268
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7.2 2.2 8 5.1" }),
269
+ /* @__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" })
270
+ ]
271
+ });
272
+ }
273
+ //#endregion
274
+ //#region src/ui/icons/panel-bottom.tsx
275
+ function PanelBottomIcon({ size, width, height, ...props }) {
276
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
277
+ xmlns: "http://www.w3.org/2000/svg",
278
+ width: size ?? width ?? 24,
279
+ height: size ?? height ?? 24,
280
+ viewBox: "0 0 24 24",
281
+ fill: "none",
282
+ stroke: "currentColor",
283
+ strokeWidth: 2,
284
+ strokeLinecap: "round",
285
+ strokeLinejoin: "round",
286
+ "aria-hidden": "true",
287
+ ...props,
288
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
289
+ width: "18",
290
+ height: "18",
291
+ x: "3",
292
+ y: "3",
293
+ rx: "2"
294
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 15h18" })]
295
+ });
296
+ }
297
+ //#endregion
298
+ //#region src/ui/icons/panel-left.tsx
299
+ function PanelLeftIcon({ size, width, height, ...props }) {
300
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
301
+ xmlns: "http://www.w3.org/2000/svg",
302
+ width: size ?? width ?? 24,
303
+ height: size ?? height ?? 24,
304
+ viewBox: "0 0 24 24",
305
+ fill: "none",
306
+ stroke: "currentColor",
307
+ strokeWidth: 2,
308
+ strokeLinecap: "round",
309
+ strokeLinejoin: "round",
310
+ "aria-hidden": "true",
311
+ ...props,
312
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
313
+ width: "18",
314
+ height: "18",
315
+ x: "3",
316
+ y: "3",
317
+ rx: "2"
318
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 3v18" })]
319
+ });
320
+ }
321
+ //#endregion
322
+ //#region src/ui/icons/panel-right.tsx
323
+ function PanelRightIcon({ size, width, height, ...props }) {
324
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
325
+ xmlns: "http://www.w3.org/2000/svg",
326
+ width: size ?? width ?? 24,
327
+ height: size ?? height ?? 24,
328
+ viewBox: "0 0 24 24",
329
+ fill: "none",
330
+ stroke: "currentColor",
331
+ strokeWidth: 2,
332
+ strokeLinecap: "round",
333
+ strokeLinejoin: "round",
334
+ "aria-hidden": "true",
335
+ ...props,
336
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
337
+ width: "18",
338
+ height: "18",
339
+ x: "3",
340
+ y: "3",
341
+ rx: "2"
342
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15 3v18" })]
343
+ });
344
+ }
345
+ //#endregion
346
+ //#region src/ui/icons/panel-top.tsx
347
+ function PanelTopIcon({ size, width, height, ...props }) {
348
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
349
+ xmlns: "http://www.w3.org/2000/svg",
350
+ width: size ?? width ?? 24,
351
+ height: size ?? height ?? 24,
352
+ viewBox: "0 0 24 24",
353
+ fill: "none",
354
+ stroke: "currentColor",
355
+ strokeWidth: 2,
356
+ strokeLinecap: "round",
357
+ strokeLinejoin: "round",
358
+ "aria-hidden": "true",
359
+ ...props,
360
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
361
+ width: "18",
362
+ height: "18",
363
+ x: "3",
364
+ y: "3",
365
+ rx: "2"
366
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 9h18" })]
367
+ });
368
+ }
369
+ //#endregion
370
+ //#region src/ui/icons/plus.tsx
371
+ function PlusIcon({ size, width, height, ...props }) {
372
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
373
+ xmlns: "http://www.w3.org/2000/svg",
374
+ width: size ?? width ?? 24,
375
+ height: size ?? height ?? 24,
376
+ viewBox: "0 0 24 24",
377
+ fill: "none",
378
+ stroke: "currentColor",
379
+ strokeWidth: 2,
380
+ strokeLinecap: "round",
381
+ strokeLinejoin: "round",
382
+ "aria-hidden": "true",
383
+ ...props,
384
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 5v14" })]
385
+ });
386
+ }
387
+ //#endregion
388
+ //#region src/ui/icons/square.tsx
389
+ function SquareIcon({ size, width, height, ...props }) {
390
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
391
+ xmlns: "http://www.w3.org/2000/svg",
392
+ width: size ?? width ?? 24,
393
+ height: size ?? height ?? 24,
394
+ viewBox: "0 0 24 24",
395
+ fill: "none",
396
+ stroke: "currentColor",
397
+ strokeWidth: 2,
398
+ strokeLinecap: "round",
399
+ strokeLinejoin: "round",
400
+ "aria-hidden": "true",
401
+ ...props,
402
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
403
+ width: "18",
404
+ height: "18",
405
+ x: "3",
406
+ y: "3",
407
+ rx: "2"
408
+ })
409
+ });
410
+ }
411
+ //#endregion
412
+ //#region src/ui/icons/square-dashed.tsx
413
+ function SquareDashedIcon({ size, width, height, ...props }) {
414
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
415
+ xmlns: "http://www.w3.org/2000/svg",
416
+ width: size ?? width ?? 24,
417
+ height: size ?? height ?? 24,
418
+ viewBox: "0 0 24 24",
419
+ fill: "none",
420
+ stroke: "currentColor",
421
+ strokeWidth: 2,
422
+ strokeLinecap: "round",
423
+ strokeLinejoin: "round",
424
+ "aria-hidden": "true",
425
+ ...props,
426
+ children: [
427
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 3a2 2 0 0 0-2 2" }),
428
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 3a2 2 0 0 1 2 2" }),
429
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 19a2 2 0 0 1-2 2" }),
430
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 21a2 2 0 0 1-2-2" }),
431
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 3h1" }),
432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 21h1" }),
433
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 3h1" }),
434
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 21h1" }),
435
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 9v1" }),
436
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 9v1" }),
437
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 14v1" }),
438
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 14v1" })
439
+ ]
440
+ });
441
+ }
442
+ //#endregion
443
+ //#region src/ui/icons/square-round-corner.tsx
444
+ function SquareRoundCornerIcon({ size, width, height, ...props }) {
445
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
446
+ xmlns: "http://www.w3.org/2000/svg",
447
+ width: size ?? width ?? 24,
448
+ height: size ?? height ?? 24,
449
+ viewBox: "0 0 24 24",
450
+ fill: "none",
451
+ stroke: "currentColor",
452
+ strokeWidth: 2,
453
+ strokeLinecap: "round",
454
+ strokeLinejoin: "round",
455
+ "aria-hidden": "true",
456
+ ...props,
457
+ 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" })]
458
+ });
459
+ }
460
+ //#endregion
461
+ //#region src/ui/icons/table.tsx
462
+ function TableIcon({ size, width, height, ...props }) {
463
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
464
+ xmlns: "http://www.w3.org/2000/svg",
465
+ width: size ?? width ?? 24,
466
+ height: size ?? height ?? 24,
467
+ viewBox: "0 0 24 24",
468
+ fill: "none",
469
+ stroke: "currentColor",
470
+ strokeWidth: 2,
471
+ strokeLinecap: "round",
472
+ strokeLinejoin: "round",
473
+ "aria-hidden": "true",
474
+ ...props,
475
+ children: [
476
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 3v18" }),
477
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
478
+ width: "18",
479
+ height: "18",
480
+ x: "3",
481
+ y: "3",
482
+ rx: "2"
483
+ }),
484
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 9h18" }),
485
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 15h18" })
486
+ ]
487
+ });
488
+ }
489
+ //#endregion
490
+ //#region src/ui/icons/type.tsx
491
+ function TypeIcon({ size, width, height, ...props }) {
492
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
493
+ xmlns: "http://www.w3.org/2000/svg",
494
+ width: size ?? width ?? 24,
495
+ height: size ?? height ?? 24,
496
+ viewBox: "0 0 24 24",
497
+ fill: "none",
498
+ stroke: "currentColor",
499
+ strokeWidth: 2,
500
+ strokeLinecap: "round",
501
+ strokeLinejoin: "round",
502
+ "aria-hidden": "true",
503
+ ...props,
504
+ children: [
505
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "4 7 4 4 20 4 20 7" }),
506
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
507
+ x1: "9",
508
+ x2: "15",
509
+ y1: "20",
510
+ y2: "20"
511
+ }),
512
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
513
+ x1: "12",
514
+ x2: "12",
515
+ y1: "4",
516
+ y2: "20"
517
+ })
518
+ ]
519
+ });
520
+ }
521
+ //#endregion
522
+ //#region src/ui/icons/x.tsx
523
+ function XIcon({ size, width, height, ...props }) {
524
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
525
+ xmlns: "http://www.w3.org/2000/svg",
526
+ width: size ?? width ?? 24,
527
+ height: size ?? height ?? 24,
528
+ viewBox: "0 0 24 24",
529
+ fill: "none",
530
+ stroke: "currentColor",
531
+ strokeWidth: 2,
532
+ strokeLinecap: "round",
533
+ strokeLinejoin: "round",
534
+ "aria-hidden": "true",
535
+ ...props,
536
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
537
+ });
538
+ }
539
+ //#endregion
540
+ //#region src/ui/editor-focus-scope.tsx
541
+ const FocusScopeContext = react.createContext(null);
542
+ function useEditorFocusScope() {
543
+ const context = react.useContext(FocusScopeContext);
544
+ if (!context) throw new Error("InspectorFocusScope must be used inside an InspectorFocusScopeProvider");
545
+ return context;
546
+ }
547
+ function EditorFocusScopeProvider({ children, clearSelectionOnBlur = true }) {
548
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
549
+ const scopeRefs = react.useRef(/* @__PURE__ */ new Set());
550
+ const handleFocusIn = react.useCallback((event) => {
551
+ if (!editor) return;
552
+ const t = event.target;
553
+ if (!(t instanceof Node) || !editor.view.dom.contains(t)) return;
554
+ editor.isFocused = true;
555
+ const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
556
+ editor.view.dispatch(transaction);
557
+ }, [editor]);
558
+ const handleFocusOut = react.useCallback((event) => {
559
+ const nextFocus = event.relatedTarget;
560
+ if (![...scopeRefs.current].some((el) => nextFocus && el.contains(nextFocus)) && editor) {
561
+ editor.isFocused = false;
562
+ const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
563
+ if (clearSelectionOnBlur) transaction.setSelection(_tiptap_pm_state.TextSelection.create(transaction.doc, 0));
564
+ editor.view.dispatch(transaction);
565
+ }
566
+ }, [editor, clearSelectionOnBlur]);
567
+ const registerScope = react.useCallback((el) => {
568
+ if (!el) return;
569
+ scopeRefs.current.add(el);
570
+ el.addEventListener("focusin", handleFocusIn);
571
+ el.addEventListener("focusout", handleFocusOut);
572
+ }, [handleFocusIn, handleFocusOut]);
573
+ const unregisterScope = react.useCallback((el) => {
574
+ if (!el) return;
575
+ scopeRefs.current.delete(el);
576
+ el.removeEventListener("focusin", handleFocusIn);
577
+ el.removeEventListener("focusout", handleFocusOut);
578
+ }, [handleFocusIn, handleFocusOut]);
579
+ react.useEffect(() => {
580
+ const defaultFocusPlugin = editor?.state.plugins.find((plugin) => plugin.spec.key === _tiptap_react.extensions.focusEventsPluginKey);
581
+ if (editor && defaultFocusPlugin) {
582
+ editor.unregisterPlugin(_tiptap_react.extensions.focusEventsPluginKey);
583
+ const pluginKey = new _tiptap_pm_state.PluginKey("inspectorReactEmailFocusEvents");
584
+ editor.registerPlugin(new _tiptap_pm_state.Plugin({
585
+ key: pluginKey,
586
+ view(view) {
587
+ registerScope(view.dom);
588
+ return { destroy() {
589
+ unregisterScope(view.dom);
590
+ } };
591
+ }
592
+ }));
593
+ return () => {
594
+ editor?.unregisterPlugin(pluginKey);
595
+ editor?.registerPlugin(defaultFocusPlugin);
596
+ };
597
+ }
598
+ }, [editor]);
599
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FocusScopeContext.Provider, {
600
+ value: {
601
+ registerScope,
602
+ unregisterScope
603
+ },
604
+ children
605
+ });
606
+ }
607
+ function EditorFocusScope({ children }) {
608
+ const { registerScope, unregisterScope } = useEditorFocusScope();
609
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_slot.Slot, {
610
+ ref: (element) => {
611
+ if (element) {
612
+ registerScope(element);
613
+ return () => {
614
+ unregisterScope(element);
615
+ };
616
+ }
617
+ },
618
+ children
619
+ });
620
+ }
621
+ //#endregion
622
+ //#region src/ui/inspector/config/node-meta.ts
623
+ const NODE_META = {
624
+ body: {
625
+ icon: LayoutIcon,
626
+ label: "Body"
627
+ },
628
+ paragraph: {
629
+ icon: TypeIcon,
630
+ label: "Text"
631
+ },
632
+ heading: {
633
+ icon: require_root.Heading1Icon,
634
+ label: "Heading"
635
+ },
636
+ image: {
637
+ icon: require_image.ImageIcon,
638
+ label: "Image"
639
+ },
640
+ button: {
641
+ icon: MousePointerClickIcon,
642
+ label: "Button"
643
+ },
644
+ link: {
645
+ icon: require_root.LinkIcon,
646
+ label: "Link"
647
+ },
648
+ codeBlock: {
649
+ icon: require_root.CodeIcon,
650
+ label: "Code Block"
651
+ },
652
+ section: {
653
+ icon: LayoutIcon,
654
+ label: "Section"
655
+ },
656
+ div: {
657
+ icon: BoxIcon,
658
+ label: "Container"
659
+ },
660
+ footer: {
661
+ icon: BoxIcon,
662
+ label: "Footer"
663
+ },
664
+ blockquote: {
665
+ icon: require_root.TextQuoteIcon,
666
+ label: "Blockquote"
667
+ },
668
+ bulletList: {
669
+ icon: require_root.ListIcon,
670
+ label: "Bullet List"
671
+ },
672
+ orderedList: {
673
+ icon: require_root.ListIcon,
674
+ label: "Ordered List"
675
+ },
676
+ listItem: {
677
+ icon: MinusIcon,
678
+ label: "List Item"
679
+ },
680
+ table: {
681
+ icon: TableIcon,
682
+ label: "Table"
683
+ },
684
+ tableRow: {
685
+ icon: MinusIcon,
686
+ label: "Table Row"
687
+ },
688
+ tableCell: {
689
+ icon: BoxIcon,
690
+ label: "Table Cell"
691
+ },
692
+ tableHeader: {
693
+ icon: BoxIcon,
694
+ label: "Table Header"
695
+ },
696
+ horizontalRule: {
697
+ icon: MinusIcon,
698
+ label: "Divider"
699
+ },
700
+ global: {
701
+ icon: SquareRoundCornerIcon,
702
+ label: "Layout"
703
+ }
704
+ };
705
+ const DEFAULT_NODE_META = {
706
+ icon: BoxIcon,
707
+ label: "Element"
708
+ };
709
+ function getNodeMeta(nodeType) {
710
+ return NODE_META[nodeType] ?? DEFAULT_NODE_META;
711
+ }
712
+ //#endregion
713
+ //#region src/ui/inspector/root.tsx
714
+ const IGNORED_NODES = ["doc", "text"];
715
+ function isHiddenFromHierarchy(node) {
716
+ return IGNORED_NODES.includes(node.type.name) || node.type.spec.selectable === false;
717
+ }
718
+ const BODY_FOCUSED = {
719
+ nodeType: "body",
720
+ nodeAttrs: {},
721
+ nodePos: {
722
+ pos: 0,
723
+ inside: 0
724
+ }
725
+ };
726
+ function computePathFromRoot(editor, target) {
727
+ if (!editor) return [];
728
+ const withBody = (path) => path[0]?.nodeType === "body" ? path : [BODY_FOCUSED, ...path];
729
+ if (typeof target === "object") {
730
+ if (target.nodeType === "body") return [BODY_FOCUSED];
731
+ const path = [...getHierarchyAtPosition(editor, target.nodePos.pos)].reverse();
732
+ return withBody(path.length > 0 ? path : [target]);
733
+ }
734
+ return withBody(getNodeHierarchy(editor).reverse());
735
+ }
736
+ function getHierarchyAtPosition(editor, pos) {
737
+ if (!editor) return [];
738
+ const { doc } = editor.state;
739
+ const hierarchy = [];
740
+ const nodeAtPos = doc.nodeAt(pos);
741
+ if (nodeAtPos && !isHiddenFromHierarchy(nodeAtPos)) hierarchy.push({
742
+ nodeType: nodeAtPos.type.name,
743
+ nodeAttrs: { ...nodeAtPos.attrs },
744
+ nodePos: {
745
+ pos,
746
+ inside: pos
747
+ }
748
+ });
749
+ const resolvedPos = doc.resolve(pos);
750
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
751
+ const node = resolvedPos.node(depth);
752
+ const nodePos = resolvedPos.before(depth);
753
+ if (node && !isHiddenFromHierarchy(node)) {
754
+ if (!hierarchy.some((h) => h.nodePos.pos === nodePos)) hierarchy.push({
755
+ nodeType: node.type.name,
756
+ nodeAttrs: { ...node.attrs },
757
+ nodePos: {
758
+ pos: nodePos,
759
+ inside: nodePos
760
+ }
761
+ });
762
+ }
763
+ }
764
+ return hierarchy;
765
+ }
766
+ function getNodeHierarchy(editor) {
767
+ if (!editor) return [];
768
+ const { selection } = editor.state;
769
+ const hierarchy = [];
770
+ if (selection instanceof _tiptap_pm_state.NodeSelection) {
771
+ const node = selection.node;
772
+ if (node && !isHiddenFromHierarchy(node)) hierarchy.push({
773
+ nodeType: node.type.name,
774
+ nodeAttrs: { ...node.attrs },
775
+ nodePos: {
776
+ pos: selection.from,
777
+ inside: selection.from
778
+ }
779
+ });
780
+ }
781
+ const { from } = selection;
782
+ const resolvedPos = editor.state.doc.resolve(from);
783
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
784
+ const node = resolvedPos.node(depth);
785
+ const pos = resolvedPos.before(depth);
786
+ if (node && !isHiddenFromHierarchy(node)) {
787
+ if (!hierarchy.some((h) => h.nodePos.pos === pos)) hierarchy.push({
788
+ nodeType: node.type.name,
789
+ nodeAttrs: { ...node.attrs },
790
+ nodePos: {
791
+ pos,
792
+ inside: pos
793
+ }
794
+ });
795
+ }
796
+ }
797
+ return hierarchy;
798
+ }
799
+ const InspectorContext = react.createContext(null);
800
+ function useInspector() {
801
+ const context = react.useContext(InspectorContext);
802
+ if (!context) throw new Error("useInspector can only be called from inside the InspectorContext. This probably means you forgot the <Inspector.Provider>");
803
+ return context;
804
+ }
805
+ const InspectorRoot = react.forwardRef(function InspectorRoot({ children, asChild, ...restProps }, forwardedRef) {
806
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
807
+ const existingFocusScope = react.useContext(FocusScopeContext);
808
+ if (editor) {
809
+ if (!editor.extensionManager.extensions.some((extension) => extension.name === "theming")) throw new Error("Inspector.Provider requires the EmailTheming extension. Add EmailTheming (or EmailTheming.configure({ ... })) to your editor extensions.");
810
+ }
811
+ const target = (0, _tiptap_react.useEditorState)({
812
+ editor,
813
+ selector(context) {
814
+ if (!context.editor) return BODY_FOCUSED;
815
+ if (!context.editor.isFocused) return BODY_FOCUSED;
816
+ const { selection } = context.editor.state;
817
+ if (selection.content().size > 0 && selection instanceof _tiptap_pm_state.TextSelection) {
818
+ const { $from } = selection;
819
+ for (let depth = $from.depth; depth > 0; depth--) if ($from.node(depth).type.name === "button") {
820
+ const pos = $from.before(depth);
821
+ const node = context.editor.state.doc.nodeAt(pos);
822
+ if (node) return {
823
+ nodeType: "button",
824
+ nodeAttrs: { ...node.attrs },
825
+ nodePos: {
826
+ pos,
827
+ inside: pos
828
+ }
829
+ };
830
+ break;
831
+ }
832
+ return "text";
833
+ }
834
+ const hierarchy = getNodeHierarchy(context.editor);
835
+ if (hierarchy.length > 0) {
836
+ const innermost = hierarchy[0];
837
+ const columnEntry = hierarchy.find((h) => h.nodeType === "columnsColumn");
838
+ return columnEntry && innermost.nodeType === "paragraph" ? columnEntry : innermost;
839
+ }
840
+ return BODY_FOCUSED;
841
+ }
842
+ }) ?? BODY_FOCUSED;
843
+ const contextValue = {
844
+ target,
845
+ pathFromRoot: react.useMemo(() => computePathFromRoot(editor, target), [editor, target])
846
+ };
847
+ const inspectorContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorFocusScope, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "aside", {
848
+ ref: forwardedRef,
849
+ ...restProps,
850
+ tabIndex: -1,
851
+ children
852
+ }) });
853
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorContext.Provider, {
854
+ value: contextValue,
855
+ children: existingFocusScope ? inspectorContent : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorFocusScopeProvider, { children: inspectorContent })
856
+ });
857
+ });
858
+ //#endregion
859
+ //#region src/ui/inspector/breadcrumb.tsx
860
+ function InspectorBreadcrumb({ children }) {
861
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
862
+ const { pathFromRoot } = useInspector();
863
+ const segments = react.default.useMemo(() => {
864
+ if (!editor || pathFromRoot.length === 0) return [];
865
+ return pathFromRoot.map((focusedNode) => ({
866
+ node: focusedNode,
867
+ focus() {
868
+ if (focusedNode.nodeType === "body") {
869
+ if (typeof document !== "undefined") {
870
+ const active = document.activeElement;
871
+ if (active instanceof HTMLElement) active.blur();
872
+ }
873
+ editor.commands.blur();
874
+ return;
875
+ }
876
+ editor.commands.setNodeSelection(focusedNode.nodePos.pos);
877
+ editor.commands.focus();
878
+ }
879
+ }));
880
+ }, [editor, pathFromRoot]);
881
+ if (children) return children(segments);
882
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BreadcrumbDefault, { segments });
883
+ }
884
+ const MAX_VISIBLE = 3;
885
+ function getVisibleSegments(segments) {
886
+ if (segments.length <= MAX_VISIBLE) return {
887
+ items: segments.map((s, i) => ({
888
+ segment: s,
889
+ index: i
890
+ })),
891
+ hasEllipsis: false
892
+ };
893
+ return {
894
+ items: [{
895
+ segment: segments[0],
896
+ index: 0
897
+ }, ...segments.slice(-2).map((s, i) => ({
898
+ segment: s,
899
+ index: segments.length - 2 + i
900
+ }))],
901
+ hasEllipsis: true
902
+ };
903
+ }
904
+ function BreadcrumbDefault({ segments }) {
905
+ const { items, hasEllipsis } = getVisibleSegments(segments);
906
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
907
+ "data-re-inspector-breadcrumb": "",
908
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
909
+ "data-re-inspector-breadcrumb-list": "",
910
+ children: items.map(({ segment, index }, i) => {
911
+ const label = getNodeMeta(segment.node.nodeType).label;
912
+ const isLast = index === segments.length - 1;
913
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
914
+ "data-re-inspector-breadcrumb-item": "",
915
+ children: [
916
+ i !== 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
917
+ "data-re-inspector-breadcrumb-separator": "",
918
+ children: "/"
919
+ }),
920
+ i === 1 && hasEllipsis && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
921
+ "data-re-inspector-breadcrumb-ellipsis": "",
922
+ children: "…"
923
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
924
+ "data-re-inspector-breadcrumb-separator": "",
925
+ children: "/"
926
+ })] }),
927
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
928
+ type: "button",
929
+ "data-re-inspector-breadcrumb-button": "",
930
+ ...!isLast ? { "data-clickable": "" } : {},
931
+ onClick: () => segment.focus(),
932
+ children: label
933
+ })
934
+ ]
935
+ }, index);
936
+ })
937
+ })
938
+ });
939
+ }
940
+ //#endregion
941
+ //#region src/ui/inspector/hooks/use-drag-to-change.ts
942
+ function useDragToChange({ value, onCommit, min, step = 1 }) {
943
+ const startXRef = react.useRef(0);
944
+ const startValueRef = react.useRef(0);
945
+ const isDraggingRef = react.useRef(false);
946
+ react.useEffect(() => {
947
+ return () => {
948
+ document.body.style.removeProperty("cursor");
949
+ document.body.style.removeProperty("user-select");
950
+ };
951
+ }, []);
952
+ const onPointerDown = react.useCallback((e) => {
953
+ e.preventDefault();
954
+ isDraggingRef.current = true;
955
+ startXRef.current = e.clientX;
956
+ startValueRef.current = Number(value) || 0;
957
+ document.body.style.cursor = "ew-resize";
958
+ document.body.style.userSelect = "none";
959
+ e.currentTarget.setPointerCapture(e.pointerId);
960
+ }, [value]);
961
+ const onPointerMove = react.useCallback((e) => {
962
+ if (!isDraggingRef.current) return;
963
+ const dx = e.clientX - startXRef.current;
964
+ const effectiveStep = e.shiftKey ? step * 10 : step;
965
+ const delta = Math.round(dx / 2) * effectiveStep;
966
+ onCommit(Math.max(min ?? Number.NEGATIVE_INFINITY, startValueRef.current + delta));
967
+ }, [
968
+ onCommit,
969
+ min,
970
+ step
971
+ ]);
972
+ const onPointerUp = react.useCallback(() => {
973
+ isDraggingRef.current = false;
974
+ document.body.style.removeProperty("cursor");
975
+ document.body.style.removeProperty("user-select");
976
+ }, []);
977
+ return { dragProps: {
978
+ onPointerDown,
979
+ onPointerMove,
980
+ onPointerUp,
981
+ onPointerCancel: onPointerUp,
982
+ style: { cursor: "ew-resize" }
983
+ } };
984
+ }
985
+ //#endregion
986
+ //#region src/ui/inspector/hooks/use-numeric-input.ts
987
+ function toDisplayString(v) {
988
+ if (v === "" || v === void 0 || v === null || Number.isNaN(v)) return "";
989
+ return String(v);
990
+ }
991
+ function useNumericInput({ value, onCommit, allowEmpty = true, min, fallbackValue }) {
992
+ const [displayValue, setDisplayValue] = react.useState(() => toDisplayString(value));
993
+ const isFocusedRef = react.useRef(false);
994
+ const cancelledRef = react.useRef(false);
995
+ react.useEffect(() => {
996
+ if (!isFocusedRef.current) setDisplayValue(toDisplayString(value));
997
+ }, [value]);
998
+ const commit = react.useCallback((raw) => {
999
+ const trimmed = raw.trim();
1000
+ if (trimmed === "") {
1001
+ if (allowEmpty) onCommit("");
1002
+ else {
1003
+ setDisplayValue("0");
1004
+ onCommit(0);
1005
+ }
1006
+ return;
1007
+ }
1008
+ const num = Number(trimmed);
1009
+ if (Number.isNaN(num)) {
1010
+ setDisplayValue(toDisplayString(value));
1011
+ return;
1012
+ }
1013
+ const clamped = Math.max(num, min ?? Number.NEGATIVE_INFINITY);
1014
+ setDisplayValue(String(clamped));
1015
+ onCommit(clamped);
1016
+ }, [
1017
+ value,
1018
+ onCommit,
1019
+ allowEmpty,
1020
+ min
1021
+ ]);
1022
+ return {
1023
+ displayValue,
1024
+ onChange: react.useCallback((e) => {
1025
+ setDisplayValue(e.target.value);
1026
+ }, []),
1027
+ onBlur: react.useCallback(() => {
1028
+ isFocusedRef.current = false;
1029
+ if (cancelledRef.current) {
1030
+ cancelledRef.current = false;
1031
+ return;
1032
+ }
1033
+ commit(displayValue);
1034
+ }, [commit, displayValue]),
1035
+ onFocus: react.useCallback((e) => {
1036
+ isFocusedRef.current = true;
1037
+ e.target.select();
1038
+ }, []),
1039
+ onKeyDown: react.useCallback((e) => {
1040
+ if (e.key === "Enter") {
1041
+ commit(displayValue);
1042
+ e.target.blur();
1043
+ }
1044
+ if (e.key === "Escape") {
1045
+ cancelledRef.current = true;
1046
+ setDisplayValue(toDisplayString(value));
1047
+ e.target.blur();
1048
+ }
1049
+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {
1050
+ e.preventDefault();
1051
+ const step = e.shiftKey ? 10 : 1;
1052
+ const trimmed = displayValue.trim();
1053
+ const parsed = Number(trimmed);
1054
+ const current = trimmed === "" || Number.isNaN(parsed) ? fallbackValue ?? 0 : parsed;
1055
+ const next = Math.max(min ?? Number.NEGATIVE_INFINITY, e.key === "ArrowUp" ? current + step : current - step);
1056
+ setDisplayValue(String(next));
1057
+ onCommit(next);
1058
+ }
1059
+ }, [
1060
+ commit,
1061
+ displayValue,
1062
+ value,
1063
+ onCommit,
1064
+ min,
1065
+ fallbackValue
1066
+ ])
1067
+ };
1068
+ }
1069
+ //#endregion
1070
+ //#region src/ui/inspector/utils/is-valid-hex-color.ts
1071
+ function isValidHexColor(value) {
1072
+ return /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
1073
+ }
1074
+ function normalizeHex(value) {
1075
+ if (!value) return "#000000";
1076
+ const v = value.trim();
1077
+ const shortHex = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(v);
1078
+ if (shortHex) return `#${shortHex[1]}${shortHex[1]}${shortHex[2]}${shortHex[2]}${shortHex[3]}${shortHex[3]}`;
1079
+ if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(v)) return v;
1080
+ return "#000000";
1081
+ }
1082
+ //#endregion
1083
+ //#region src/ui/inspector/primitives/color-input.tsx
1084
+ function ColorInput({ value, onChange, className }) {
1085
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1086
+ "data-re-inspector-color-control": "",
1087
+ className,
1088
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1089
+ type: "color",
1090
+ "data-re-inspector-color-trigger": "",
1091
+ value: normalizeHex(value),
1092
+ onChange: (e) => onChange(e.target.value)
1093
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1094
+ type: "text",
1095
+ "data-re-inspector-color-hex": "",
1096
+ value,
1097
+ onChange: (e) => onChange(e.target.value)
1098
+ })]
1099
+ });
1100
+ }
1101
+ //#endregion
1102
+ //#region src/ui/inspector/primitives/icon-button.tsx
1103
+ function IconButton({ className, children, ...rest }) {
1104
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1105
+ type: "button",
1106
+ "data-re-inspector-icon-button": "",
1107
+ className,
1108
+ ...rest,
1109
+ children
1110
+ });
1111
+ }
1112
+ //#endregion
1113
+ //#region src/ui/inspector/primitives/label.tsx
1114
+ function Label({ className, ...rest }) {
1115
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1116
+ "data-re-inspector-label": "",
1117
+ className,
1118
+ ...rest
1119
+ });
1120
+ }
1121
+ //#endregion
1122
+ //#region src/ui/inspector/primitives/select.tsx
1123
+ function SelectRoot({ children, ...rest }) {
1124
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
1125
+ "data-re-inspector-select": "",
1126
+ ...rest,
1127
+ children
1128
+ });
1129
+ }
1130
+ function SelectItem(props) {
1131
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", { ...props });
1132
+ }
1133
+ const Root$2 = SelectRoot;
1134
+ const Item$1 = SelectItem;
1135
+ //#endregion
1136
+ //#region src/ui/inspector/primitives/text.tsx
1137
+ function Text({ size, color, className, ...rest }) {
1138
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1139
+ "data-re-inspector-text": "",
1140
+ ...size ? { "data-size": size } : {},
1141
+ ...color ? { "data-color": color } : {},
1142
+ className,
1143
+ ...rest
1144
+ });
1145
+ }
1146
+ //#endregion
1147
+ //#region src/ui/inspector/primitives/text-field.tsx
1148
+ const TextField = react.forwardRef(function TextField({ className, ...rest }, ref) {
1149
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1150
+ ref,
1151
+ "data-re-inspector-input": "",
1152
+ className,
1153
+ ...rest
1154
+ });
1155
+ });
1156
+ //#endregion
1157
+ //#region src/ui/inspector/primitives/textarea.tsx
1158
+ const Textarea = react.forwardRef(function Textarea({ className, ...rest }, ref) {
1159
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1160
+ ref,
1161
+ "data-re-inspector-input": "",
1162
+ "data-type": "textarea",
1163
+ className,
1164
+ ...rest
1165
+ });
1166
+ });
1167
+ //#endregion
1168
+ //#region src/ui/inspector/primitives/toggle-group.tsx
1169
+ const ToggleGroupContext = react.createContext(null);
1170
+ function Root$1({ value, onValueChange, children, className }) {
1171
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext.Provider, {
1172
+ value: {
1173
+ value,
1174
+ onValueChange
1175
+ },
1176
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1177
+ "data-re-inspector-toggle-group": "",
1178
+ className,
1179
+ role: "group",
1180
+ children
1181
+ })
1182
+ });
1183
+ }
1184
+ function Item({ value, children, ...rest }) {
1185
+ const ctx = react.useContext(ToggleGroupContext);
1186
+ const isActive = ctx?.value === value;
1187
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1188
+ type: "button",
1189
+ "data-re-inspector-toggle-item": "",
1190
+ ...isActive ? { "data-active": "" } : {},
1191
+ "aria-pressed": isActive,
1192
+ ...rest,
1193
+ onClick: (e) => {
1194
+ ctx?.onValueChange(value);
1195
+ rest.onClick?.(e);
1196
+ },
1197
+ children
1198
+ });
1199
+ }
1200
+ //#endregion
1201
+ //#region src/ui/inspector/primitives/tooltip.tsx
1202
+ function TooltipRoot({ children, ...rest }) {
1203
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1204
+ "data-re-inspector-tooltip": "",
1205
+ ...rest,
1206
+ children
1207
+ });
1208
+ }
1209
+ function TooltipTrigger({ children, ...rest }) {
1210
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1211
+ "data-re-inspector-tooltip-trigger": "",
1212
+ ...rest,
1213
+ children
1214
+ });
1215
+ }
1216
+ function TooltipContent({ children, ...rest }) {
1217
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1218
+ "data-re-inspector-tooltip-content": "",
1219
+ ...rest,
1220
+ children
1221
+ });
1222
+ }
1223
+ const Root = TooltipRoot;
1224
+ const Trigger = TooltipTrigger;
1225
+ const Content = TooltipContent;
1226
+ //#endregion
1227
+ //#region src/ui/inspector/components/number-input.tsx
1228
+ function NumberInput({ icon, value, onChange, placeholder, unit, min, unitOptions, onUnitChange }) {
1229
+ const { displayValue, ...handlers } = useNumericInput({
1230
+ value,
1231
+ onCommit: onChange,
1232
+ min,
1233
+ fallbackValue: placeholder ? Number(placeholder) : void 0
1234
+ });
1235
+ const { dragProps } = useDragToChange({
1236
+ value,
1237
+ onCommit: onChange,
1238
+ min
1239
+ });
1240
+ const hasUnitSelect = unitOptions && unitOptions.length > 1 && onUnitChange;
1241
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1242
+ "data-re-inspector-number": "",
1243
+ children: [
1244
+ icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1245
+ className: "pointer-events-none",
1246
+ "aria-hidden": true,
1247
+ children: icon
1248
+ }),
1249
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
1250
+ value: displayValue,
1251
+ placeholder,
1252
+ type: "text",
1253
+ inputMode: "numeric",
1254
+ "data-type": "number",
1255
+ ...handlers
1256
+ }),
1257
+ hasUnitSelect ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
1258
+ value: unit,
1259
+ onChange: (e) => onUnitChange(e.target.value),
1260
+ children: unitOptions.map((opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item$1, {
1261
+ value: opt,
1262
+ children: opt
1263
+ }, opt))
1264
+ }) : unit && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1265
+ "data-re-inspector-unit": "",
1266
+ ...dragProps,
1267
+ children: unit
1268
+ })
1269
+ ]
1270
+ });
1271
+ }
1272
+ //#endregion
1273
+ //#region src/ui/inspector/components/prop-row.tsx
1274
+ function PropRow({ children, className }) {
1275
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1276
+ "data-re-inspector-prop-row": "",
1277
+ className,
1278
+ children
1279
+ });
1280
+ }
1281
+ //#endregion
1282
+ //#region src/ui/inspector/components/section.tsx
1283
+ function Section({ title, children, onAdd, onRemove }) {
1284
+ const [collapsed, setCollapsed] = react.useState(false);
1285
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1286
+ "data-re-inspector-section": "",
1287
+ ...title ? { "data-has-title": "" } : {},
1288
+ children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1289
+ "data-re-inspector-section-header": "",
1290
+ children: [
1291
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1292
+ type: "button",
1293
+ "data-re-inspector-section-toggle": "",
1294
+ onClick: () => setCollapsed((c) => !c),
1295
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, { children: title })
1296
+ }),
1297
+ collapsed && onAdd && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
1298
+ onClick: onAdd,
1299
+ "aria-label": `Add ${title}`,
1300
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PlusIcon, { size: 16 })
1301
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: `Add ${title}` })] }),
1302
+ !collapsed && onRemove && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
1303
+ onClick: onRemove,
1304
+ "aria-label": `Remove ${title}`,
1305
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MinusIcon, { size: 16 })
1306
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: `Remove ${title}` })] })
1307
+ ]
1308
+ }), !collapsed && children && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1309
+ "data-re-inspector-section-body": "",
1310
+ children
1311
+ })]
1312
+ });
1313
+ }
1314
+ //#endregion
1315
+ //#region src/ui/inspector/document.tsx
1316
+ function ensureAllProperties(currentStyles, themeDefaults) {
1317
+ return currentStyles.map((group) => {
1318
+ const defaultGroup = themeDefaults.find((g) => group.id ? g.id === group.id : g.title === group.title);
1319
+ if (!defaultGroup || defaultGroup.inputs.length === 0) return group;
1320
+ const existingProps = new Set(group.inputs.map((i) => `${i.classReference}:${i.prop}`));
1321
+ const missingInputs = defaultGroup.inputs.filter((defaultInput) => !existingProps.has(`${defaultInput.classReference}:${defaultInput.prop}`)).map((defaultInput) => {
1322
+ const propDef = require_extension.SUPPORTED_CSS_PROPERTIES[defaultInput.prop];
1323
+ if (propDef && propDef.type === "number") return {
1324
+ ...defaultInput,
1325
+ value: "",
1326
+ placeholder: String(propDef.defaultValue)
1327
+ };
1328
+ return { ...defaultInput };
1329
+ });
1330
+ if (missingInputs.length === 0) return group;
1331
+ return {
1332
+ ...group,
1333
+ inputs: [...group.inputs, ...missingInputs]
1334
+ };
1335
+ });
1336
+ }
1337
+ function applyStyleChange(styles, themeName, { classReference, prop, newValue }) {
1338
+ let found = false;
1339
+ const updatedStyles = styles.map((styleGroup) => {
1340
+ if (styleGroup.inputs.find((input) => input.classReference === classReference && input.prop === prop)) {
1341
+ found = true;
1342
+ return {
1343
+ ...styleGroup,
1344
+ inputs: styleGroup.inputs.map((input) => {
1345
+ if (input.classReference === classReference && input.prop === prop) return {
1346
+ ...input,
1347
+ value: newValue
1348
+ };
1349
+ return input;
1350
+ })
1351
+ };
1352
+ }
1353
+ return styleGroup;
1354
+ });
1355
+ if (found) return updatedStyles;
1356
+ const propDef = require_extension.SUPPORTED_CSS_PROPERTIES[prop] ?? null;
1357
+ return updatedStyles.map((styleGroup) => {
1358
+ if (styleGroup.classReference !== classReference) return styleGroup;
1359
+ 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);
1360
+ if (defaultInput) return {
1361
+ ...styleGroup,
1362
+ inputs: [...styleGroup.inputs, {
1363
+ ...defaultInput,
1364
+ value: newValue
1365
+ }]
1366
+ };
1367
+ if (propDef) return {
1368
+ ...styleGroup,
1369
+ inputs: [...styleGroup.inputs, {
1370
+ label: propDef.label,
1371
+ type: propDef.type,
1372
+ value: newValue,
1373
+ prop,
1374
+ classReference,
1375
+ unit: propDef.unit,
1376
+ options: propDef.options
1377
+ }]
1378
+ };
1379
+ return styleGroup;
1380
+ });
1381
+ }
1382
+ function InspectorDocument({ children }) {
1383
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
1384
+ const theming = require_extension.useEmailTheming(editor);
1385
+ const { target } = useInspector();
1386
+ if (!editor || !theming) return null;
1387
+ const themeDefaults = require_extension.EDITOR_THEMES[theming.theme];
1388
+ const groups = ensureAllProperties(theming.styles, themeDefaults);
1389
+ function setGlobalStyle(classReference, property, value) {
1390
+ require_extension.setGlobalStyles(editor, applyStyleChange(theming.styles, theming.theme, {
1391
+ classReference,
1392
+ prop: property,
1393
+ newValue: value
1394
+ }));
1395
+ }
1396
+ function batchSetGlobalStyle(changes) {
1397
+ let styles = theming.styles;
1398
+ for (const change of changes) styles = applyStyleChange(styles, theming.theme, {
1399
+ classReference: change.classReference,
1400
+ prop: change.property,
1401
+ newValue: change.value
1402
+ });
1403
+ require_extension.setGlobalStyles(editor, styles);
1404
+ }
1405
+ function findStyleValue(classReference, prop) {
1406
+ for (const group of groups) {
1407
+ const input = group.inputs.find((i) => i.classReference === classReference && i.prop === prop);
1408
+ if (input && input.value !== void 0) return input.value;
1409
+ }
1410
+ for (const group of themeDefaults) {
1411
+ const input = group.inputs.find((i) => i.classReference === classReference && i.prop === prop);
1412
+ if (input && input.value !== void 0) return input.value;
1413
+ }
1414
+ return require_extension.SUPPORTED_CSS_PROPERTIES[prop]?.defaultValue ?? "";
1415
+ }
1416
+ if (typeof target !== "object" || target.nodeType !== "body") return null;
1417
+ const context = {
1418
+ styles: groups,
1419
+ setGlobalStyle,
1420
+ batchSetGlobalStyle,
1421
+ findStyleValue
1422
+ };
1423
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children(context) });
1424
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorDocumentDefaults, { context });
1425
+ }
1426
+ function InspectorDocumentDefaults({ context }) {
1427
+ const { findStyleValue, setGlobalStyle } = context;
1428
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
1429
+ title: "Background",
1430
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Color" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
1431
+ value: String(findStyleValue("body", "backgroundColor") ?? ""),
1432
+ onChange: (v) => setGlobalStyle("body", "backgroundColor", v)
1433
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Padding" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
1434
+ value: findStyleValue("body", "padding") ?? "",
1435
+ onChange: (v) => setGlobalStyle("body", "padding", v),
1436
+ unit: "px"
1437
+ })] })]
1438
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
1439
+ title: "Container",
1440
+ children: [
1441
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Color" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
1442
+ value: String(findStyleValue("container", "backgroundColor") ?? ""),
1443
+ onChange: (v) => setGlobalStyle("container", "backgroundColor", v)
1444
+ })] }),
1445
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Width" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
1446
+ value: findStyleValue("container", "width") ?? "",
1447
+ onChange: (v) => setGlobalStyle("container", "width", v),
1448
+ unit: "px"
1449
+ })] }),
1450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Padding" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
1451
+ value: findStyleValue("container", "padding") ?? "",
1452
+ onChange: (v) => setGlobalStyle("container", "padding", v),
1453
+ unit: "px"
1454
+ })] }),
1455
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Rounded" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
1456
+ value: findStyleValue("container", "borderRadius") ?? "",
1457
+ onChange: (v) => setGlobalStyle("container", "borderRadius", v),
1458
+ unit: "px"
1459
+ })] })
1460
+ ]
1461
+ })] });
1462
+ }
1463
+ //#endregion
1464
+ //#region src/ui/inspector/hooks/use-document-colors.ts
1465
+ const COLOR_CSS_PROPERTIES = [
1466
+ "color",
1467
+ "backgroundColor",
1468
+ "borderColor",
1469
+ "borderTopColor",
1470
+ "borderRightColor",
1471
+ "borderBottomColor",
1472
+ "borderLeftColor"
1473
+ ];
1474
+ function useDocumentColors(editor) {
1475
+ const theming = require_extension.useEmailTheming(editor);
1476
+ const globalColors = react.useMemo(() => {
1477
+ const colors = /* @__PURE__ */ new Set();
1478
+ const cssJs = require_extension.stylesToCss(theming.styles, theming.theme);
1479
+ for (const componentStyles of Object.values(cssJs)) {
1480
+ if (!componentStyles || typeof componentStyles !== "object") continue;
1481
+ for (const prop of COLOR_CSS_PROPERTIES) {
1482
+ const value = componentStyles[prop];
1483
+ if (typeof value === "string") addColor(colors, value);
1484
+ }
1485
+ }
1486
+ return Array.from(colors);
1487
+ }, [theming]);
1488
+ const inlineColors = (0, _tiptap_react.useEditorState)({
1489
+ editor,
1490
+ selector: ({ editor: ed }) => {
1491
+ if (!ed) return [];
1492
+ const colors = /* @__PURE__ */ new Set();
1493
+ ed.state.doc.descendants((node) => {
1494
+ for (const mark of node.marks) if (mark.type.name === "textStyle" && mark.attrs.color) addColor(colors, mark.attrs.color);
1495
+ const style = node.attrs.style;
1496
+ if (style) extractColorsFromInlineStyle(colors, style);
1497
+ });
1498
+ return Array.from(colors);
1499
+ },
1500
+ equalityFn: (a, b) => {
1501
+ if (a === b) return true;
1502
+ if (!a || !b) return false;
1503
+ return arrayShallowEqual(a, b);
1504
+ }
1505
+ }) ?? [];
1506
+ return react.useMemo(() => {
1507
+ if (globalColors.length === 0) return inlineColors;
1508
+ if (inlineColors.length === 0) return globalColors;
1509
+ const merged = new Set([...globalColors, ...inlineColors]);
1510
+ return Array.from(merged);
1511
+ }, [globalColors, inlineColors]);
1512
+ }
1513
+ const COLOR_STYLE_PROPS = [
1514
+ "color",
1515
+ "background-color",
1516
+ "border-color",
1517
+ "border-top-color",
1518
+ "border-right-color",
1519
+ "border-bottom-color",
1520
+ "border-left-color"
1521
+ ];
1522
+ function extractColorsFromInlineStyle(colors, style) {
1523
+ for (const prop of COLOR_STYLE_PROPS) {
1524
+ const regex = new RegExp(`${prop}\\s*:\\s*([^;]+)`, "i");
1525
+ const match = style.match(regex);
1526
+ if (match) addColor(colors, match[1].trim());
1527
+ }
1528
+ }
1529
+ function addColor(colors, raw) {
1530
+ const value = raw.trim().toLowerCase();
1531
+ if (!value || value === "#000000" || value === "#ffffff") return;
1532
+ if (isValidHexColor(value)) {
1533
+ const normalized = expandToSix(value);
1534
+ colors.add(normalized);
1535
+ }
1536
+ }
1537
+ function expandToSix(hex) {
1538
+ const h = hex.slice(1);
1539
+ if (h.length === 3) return `#${h[0]}${h[0]}${h[1]}${h[1]}${h[2]}${h[2]}`;
1540
+ if (h.length === 4) return `#${h[0]}${h[0]}${h[1]}${h[1]}${h[2]}${h[2]}`;
1541
+ if (h.length === 8) return `#${h.slice(0, 6)}`;
1542
+ return hex;
1543
+ }
1544
+ function arrayShallowEqual(a, b) {
1545
+ if (a.length !== b.length) return false;
1546
+ for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
1547
+ return true;
1548
+ }
1549
+ //#endregion
1550
+ //#region src/ui/inspector/config/attribute-schema.ts
1551
+ const LOCAL_PROPS_SCHEMA = {
1552
+ class: {
1553
+ label: "Class",
1554
+ type: "text",
1555
+ defaultValue: ""
1556
+ },
1557
+ width: {
1558
+ label: "Width",
1559
+ type: "number",
1560
+ unit: "px",
1561
+ placeholder: "auto",
1562
+ defaultValue: 100
1563
+ },
1564
+ height: {
1565
+ label: "Height",
1566
+ type: "number",
1567
+ unit: "px",
1568
+ placeholder: "auto",
1569
+ defaultValue: 100
1570
+ },
1571
+ alt: {
1572
+ label: "Alt",
1573
+ type: "textarea",
1574
+ defaultValue: ""
1575
+ },
1576
+ align: {
1577
+ label: "Align",
1578
+ type: "select",
1579
+ defaultValue: "left",
1580
+ options: {
1581
+ left: "Left",
1582
+ center: "Center",
1583
+ right: "Right"
1584
+ }
1585
+ },
1586
+ alignment: {
1587
+ label: "Alignment",
1588
+ type: "select",
1589
+ defaultValue: "left",
1590
+ options: {
1591
+ left: "Left",
1592
+ center: "Center",
1593
+ right: "Right"
1594
+ }
1595
+ },
1596
+ level: {
1597
+ label: "Level",
1598
+ type: "number",
1599
+ defaultValue: 1
1600
+ },
1601
+ src: {
1602
+ label: "Source",
1603
+ type: "text",
1604
+ defaultValue: "",
1605
+ options: { enableVariables: true }
1606
+ },
1607
+ href: {
1608
+ label: "Link",
1609
+ type: "text",
1610
+ defaultValue: ""
1611
+ },
1612
+ title: {
1613
+ label: "Title",
1614
+ type: "text",
1615
+ defaultValue: ""
1616
+ },
1617
+ language: {
1618
+ label: "Language",
1619
+ type: "select",
1620
+ defaultValue: "javascript",
1621
+ options: {
1622
+ css: "CSS",
1623
+ go: "Go",
1624
+ html: "HTML",
1625
+ javascript: "JavaScript",
1626
+ jsx: "JSX",
1627
+ json: "JSON",
1628
+ markdown: "Markdown",
1629
+ php: "PHP",
1630
+ plaintext: "Plain text",
1631
+ python: "Python",
1632
+ ruby: "Ruby",
1633
+ shell: "Shell",
1634
+ sql: "SQL",
1635
+ svg: "svg",
1636
+ typescript: "TypeScript"
1637
+ }
1638
+ },
1639
+ theme: {
1640
+ label: "Theme",
1641
+ type: "select",
1642
+ defaultValue: "default",
1643
+ options: {
1644
+ default: "Default",
1645
+ atomDark: "Atom Dark",
1646
+ oneLight: "One Light",
1647
+ dracula: "Dracula",
1648
+ nord: "Nord",
1649
+ duotoneDark: "Duotone Dark",
1650
+ duotoneForest: "Duotone Forest",
1651
+ duotoneLight: "Duotone Light",
1652
+ duotoneSea: "Duotone Sea",
1653
+ duotoneSpace: "Duotone Space",
1654
+ vesper: "Vesper",
1655
+ vs: "VSCode Light",
1656
+ vscDarkPlus: "VSCode Dark"
1657
+ },
1658
+ customUpdate: ({ newValue }) => {
1659
+ require_columns.loadPrismTheme(newValue);
1660
+ }
1661
+ }
1662
+ };
1663
+ const EXCLUDED_ATTRIBUTES = [
1664
+ "style",
1665
+ "class",
1666
+ "width",
1667
+ "height",
1668
+ "align",
1669
+ "alignment",
1670
+ "href",
1671
+ "id",
1672
+ "title",
1673
+ "lang",
1674
+ "dir",
1675
+ "data-id"
1676
+ ];
1677
+ const LIVEBLOCKS_INTERNAL_PROPS = ["ychange"];
1678
+ //#endregion
1679
+ //#region src/ui/inspector/sections/attributes.tsx
1680
+ function AttributesSection({ nodeType, getAttr, setAttr }) {
1681
+ const nodeAttrs = getVisibleAttributes(nodeType, getAttr);
1682
+ if (nodeAttrs.length === 0) return null;
1683
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
1684
+ title: "Attributes",
1685
+ children: nodeAttrs.map(({ name, config, value }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: config.label }), config.type === "select" && config.options ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
1686
+ value: String(value ?? config.defaultValue),
1687
+ onChange: (e) => {
1688
+ const newValue = e.target.value;
1689
+ setAttr(name, newValue);
1690
+ config.customUpdate?.({ newValue });
1691
+ },
1692
+ children: Object.entries(config.options).filter(([, v]) => typeof v === "string").map(([val, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item$1, {
1693
+ value: val,
1694
+ children: label
1695
+ }, val))
1696
+ }) : config.type === "number" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
1697
+ value: value ?? config.defaultValue,
1698
+ onChange: (v) => setAttr(name, v),
1699
+ unit: config.unit,
1700
+ min: 0
1701
+ }) : config.type === "textarea" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Textarea, {
1702
+ value: String(value ?? config.defaultValue),
1703
+ onChange: (e) => setAttr(name, e.target.value)
1704
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
1705
+ type: "text",
1706
+ value: String(value ?? config.defaultValue),
1707
+ onChange: (e) => setAttr(name, e.target.value)
1708
+ })] }, name))
1709
+ });
1710
+ }
1711
+ function getVisibleAttributes(_nodeType, getAttr) {
1712
+ const results = [];
1713
+ for (const [name, config] of Object.entries(LOCAL_PROPS_SCHEMA)) {
1714
+ if (EXCLUDED_ATTRIBUTES.includes(name)) continue;
1715
+ if (LIVEBLOCKS_INTERNAL_PROPS.includes(name)) continue;
1716
+ const value = getAttr(name);
1717
+ if (value !== void 0 && value !== null) results.push({
1718
+ name,
1719
+ config,
1720
+ value
1721
+ });
1722
+ }
1723
+ return results;
1724
+ }
1725
+ //#endregion
1726
+ //#region src/ui/inspector/sections/background.tsx
1727
+ function BackgroundSection({ getStyle, setStyle }) {
1728
+ const value = String(getStyle("backgroundColor") ?? "");
1729
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
1730
+ title: "Background",
1731
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Color" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
1732
+ value,
1733
+ onChange: (v) => setStyle("backgroundColor", v)
1734
+ })] })
1735
+ });
1736
+ }
1737
+ //#endregion
1738
+ //#region src/ui/inspector/components/border-picker.tsx
1739
+ const SIDES = [
1740
+ {
1741
+ side: "Top",
1742
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelTopIcon, { size: 14 })
1743
+ },
1744
+ {
1745
+ side: "Right",
1746
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelRightIcon, { size: 14 })
1747
+ },
1748
+ {
1749
+ side: "Bottom",
1750
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelBottomIcon, { size: 14 })
1751
+ },
1752
+ {
1753
+ side: "Left",
1754
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelLeftIcon, { size: 14 })
1755
+ }
1756
+ ];
1757
+ function getSideValue(styleObject, side, prop) {
1758
+ const sideKey = `border${side}${prop}`;
1759
+ const shorthandKey = `border${prop}`;
1760
+ return styleObject[sideKey] ?? styleObject[shorthandKey];
1761
+ }
1762
+ function allSidesEqual(styleObject) {
1763
+ const topWidth = getSideValue(styleObject, "Top", "Width");
1764
+ const topColor = getSideValue(styleObject, "Top", "Color");
1765
+ const topStyle = getSideValue(styleObject, "Top", "Style");
1766
+ return SIDES.every(({ side }) => {
1767
+ return getSideValue(styleObject, side, "Width") === topWidth && getSideValue(styleObject, side, "Color") === topColor && getSideValue(styleObject, side, "Style") === topStyle;
1768
+ });
1769
+ }
1770
+ const BORDER_STYLE_OPTIONS = require_extension.SUPPORTED_CSS_PROPERTIES.borderStyle.options;
1771
+ function BorderPicker({ styleObject, onChange }) {
1772
+ const [expanded, setExpanded] = react.useState(() => !allSidesEqual(styleObject));
1773
+ const handleModeChange = (mode) => {
1774
+ if (mode === "uniform" && expanded) {
1775
+ const width = getSideValue(styleObject, "Top", "Width") ?? String(require_extension.SUPPORTED_CSS_PROPERTIES.borderWidth.defaultValue);
1776
+ const color = getSideValue(styleObject, "Top", "Color") ?? String(require_extension.SUPPORTED_CSS_PROPERTIES.borderColor.defaultValue);
1777
+ const style = getSideValue(styleObject, "Top", "Style") ?? String(require_extension.SUPPORTED_CSS_PROPERTIES.borderStyle.defaultValue);
1778
+ const changes = [
1779
+ ["borderWidth", width],
1780
+ ["borderColor", color],
1781
+ ["borderStyle", style]
1782
+ ];
1783
+ for (const { side } of SIDES) changes.push([`border${side}Width`, ""], [`border${side}Color`, ""], [`border${side}Style`, ""]);
1784
+ onChange(changes);
1785
+ setExpanded(false);
1786
+ } else if (mode === "individual" && !expanded) {
1787
+ const width = styleObject.borderWidth ?? String(require_extension.SUPPORTED_CSS_PROPERTIES.borderWidth.defaultValue);
1788
+ const color = styleObject.borderColor ?? String(require_extension.SUPPORTED_CSS_PROPERTIES.borderColor.defaultValue);
1789
+ const style = styleObject.borderStyle ?? String(require_extension.SUPPORTED_CSS_PROPERTIES.borderStyle.defaultValue);
1790
+ const changes = [];
1791
+ for (const { side } of SIDES) changes.push([`border${side}Width`, styleObject[`border${side}Width`] ?? width], [`border${side}Color`, styleObject[`border${side}Color`] ?? color], [`border${side}Style`, styleObject[`border${side}Style`] ?? style]);
1792
+ changes.push(["borderWidth", ""], ["borderColor", ""], ["borderStyle", ""]);
1793
+ onChange(changes);
1794
+ setExpanded(true);
1795
+ }
1796
+ };
1797
+ const modeToggle = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
1798
+ value: expanded ? "individual" : "uniform",
1799
+ onValueChange: handleModeChange,
1800
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
1801
+ value: "uniform",
1802
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareIcon, { size: 16 })
1803
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: "Uniform" })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
1804
+ value: "individual",
1805
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareDashedIcon, { size: 16 })
1806
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: "Per side" })] })]
1807
+ });
1808
+ if (expanded) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1809
+ className: "flex flex-col gap-2",
1810
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Border" }), modeToggle] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1811
+ className: "flex flex-col gap-1.5",
1812
+ children: SIDES.map(({ side, icon }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1813
+ className: "flex flex-col items-center gap-1",
1814
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1815
+ className: "flex gap-1 w-full",
1816
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderWidthInput, {
1817
+ icon,
1818
+ value: getSideValue(styleObject, side, "Width"),
1819
+ onChange: (v) => onChange(`border${side}Width`, v),
1820
+ className: "w-full"
1821
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
1822
+ value: String(getSideValue(styleObject, side, "Color") ?? require_extension.SUPPORTED_CSS_PROPERTIES.borderColor.defaultValue),
1823
+ onChange: (v) => onChange(`border${side}Color`, v),
1824
+ className: "w-full"
1825
+ })]
1826
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1827
+ className: "flex gap-1 w-full",
1828
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
1829
+ className: "w-full",
1830
+ value: String(getSideValue(styleObject, side, "Style") ?? require_extension.SUPPORTED_CSS_PROPERTIES.borderStyle.defaultValue),
1831
+ onChange: (e) => onChange(`border${side}Style`, e.target.value),
1832
+ children: Object.entries(BORDER_STYLE_OPTIONS).map(([val, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item$1, {
1833
+ value: val,
1834
+ children: label
1835
+ }, val))
1836
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
1837
+ onClick: () => {
1838
+ onChange([
1839
+ [`border${side}Width`, ""],
1840
+ [`border${side}Style`, ""],
1841
+ [`border${side}Color`, ""]
1842
+ ]);
1843
+ },
1844
+ "aria-label": `Clear ${side.toLowerCase()} border`,
1845
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(XIcon, { size: 14 })
1846
+ })]
1847
+ })]
1848
+ }, side))
1849
+ })]
1850
+ });
1851
+ const uniformColor = String(styleObject.borderColor ?? require_extension.SUPPORTED_CSS_PROPERTIES.borderColor.defaultValue);
1852
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1853
+ className: "flex flex-col gap-3 w-full",
1854
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Border" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1855
+ className: "flex items-center gap-1",
1856
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderWidthInput, {
1857
+ value: styleObject.borderWidth ?? "",
1858
+ onChange: (v) => onChange("borderWidth", v)
1859
+ }), modeToggle]
1860
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Border color" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
1861
+ value: uniformColor,
1862
+ onChange: (v) => onChange("borderColor", v)
1863
+ })] })]
1864
+ });
1865
+ }
1866
+ function BorderWidthInput({ icon, value, onChange, className }) {
1867
+ const { displayValue, ...handlers } = useNumericInput({
1868
+ value,
1869
+ onCommit: onChange,
1870
+ allowEmpty: true,
1871
+ min: 0
1872
+ });
1873
+ const { dragProps } = useDragToChange({
1874
+ value,
1875
+ onCommit: onChange,
1876
+ min: 0
1877
+ });
1878
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1879
+ "data-re-inspector-number": "",
1880
+ className,
1881
+ children: [
1882
+ icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1883
+ className: "pointer-events-none",
1884
+ "aria-hidden": true,
1885
+ children: icon
1886
+ }),
1887
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
1888
+ type: "text",
1889
+ inputMode: "numeric",
1890
+ "data-type": "number",
1891
+ value: displayValue,
1892
+ placeholder: String(require_extension.SUPPORTED_CSS_PROPERTIES.borderWidth.defaultValue),
1893
+ ...handlers
1894
+ }),
1895
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1896
+ "data-re-inspector-unit": "",
1897
+ ...dragProps,
1898
+ children: "px"
1899
+ })
1900
+ ]
1901
+ });
1902
+ }
1903
+ //#endregion
1904
+ //#region src/ui/inspector/components/border-radius-picker.tsx
1905
+ function BorderRadiusPicker({ value, onChange, unit = "px" }) {
1906
+ const expandedValues = expandShorthand(value);
1907
+ const allEqual = Object.values(expandedValues).every((v) => v === expandedValues.borderTopLeftRadius);
1908
+ const [expanded, setExpanded] = react.useState(!allEqual);
1909
+ const handleModeChange = (mode) => {
1910
+ if (mode === "uniform" && expanded) {
1911
+ onChange(`${expandedValues.borderTopLeftRadius ?? expandedValues.borderTopRightRadius ?? expandedValues.borderBottomRightRadius ?? expandedValues.borderBottomLeftRadius ?? 0}${unit}`);
1912
+ setExpanded(false);
1913
+ } else if (mode === "individual" && !expanded) setExpanded(true);
1914
+ };
1915
+ const modeToggle = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
1916
+ value: expanded ? "individual" : "uniform",
1917
+ onValueChange: handleModeChange,
1918
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
1919
+ value: "uniform",
1920
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareIcon, { size: 16 })
1921
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: "Uniform" })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
1922
+ value: "individual",
1923
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareDashedIcon, { size: 16 })
1924
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: "Per corner" })] })]
1925
+ });
1926
+ if (expanded) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1927
+ className: "flex flex-col gap-2",
1928
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Rounded" }), modeToggle] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1929
+ className: "flex flex-col items-center gap-1.5",
1930
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1931
+ className: "flex items-center gap-1.5",
1932
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadiusInput, {
1933
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CornerTopLeftIcon, { size: 14 }),
1934
+ value: expandedValues.borderTopLeftRadius,
1935
+ onChange: (v) => onChange(collapseToShorthand({
1936
+ ...expandedValues,
1937
+ borderTopLeftRadius: v,
1938
+ unit
1939
+ })),
1940
+ unit
1941
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadiusInput, {
1942
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CornerTopRightIcon, { size: 14 }),
1943
+ value: expandedValues.borderTopRightRadius,
1944
+ onChange: (v) => onChange(collapseToShorthand({
1945
+ ...expandedValues,
1946
+ borderTopRightRadius: v,
1947
+ unit
1948
+ })),
1949
+ unit
1950
+ })]
1951
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1952
+ className: "flex items-center gap-1.5",
1953
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadiusInput, {
1954
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CornerBottomLeftIcon, { size: 14 }),
1955
+ value: expandedValues.borderBottomLeftRadius,
1956
+ onChange: (v) => onChange(collapseToShorthand({
1957
+ ...expandedValues,
1958
+ borderBottomLeftRadius: v,
1959
+ unit
1960
+ })),
1961
+ unit
1962
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadiusInput, {
1963
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CornerBottomRightIcon, { size: 14 }),
1964
+ value: expandedValues.borderBottomRightRadius,
1965
+ onChange: (v) => onChange(collapseToShorthand({
1966
+ ...expandedValues,
1967
+ borderBottomRightRadius: v,
1968
+ unit
1969
+ })),
1970
+ unit
1971
+ })]
1972
+ })]
1973
+ })]
1974
+ });
1975
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Rounded" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1976
+ className: "flex items-center gap-1",
1977
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadiusInput, {
1978
+ value: expandedValues.borderTopLeftRadius,
1979
+ onChange: (v) => onChange(`${v}${unit}`),
1980
+ unit
1981
+ }), modeToggle]
1982
+ })] });
1983
+ }
1984
+ function RadiusInput({ icon, value, onChange, unit }) {
1985
+ const onCommit = (v) => onChange(v === "" ? 0 : v);
1986
+ const { displayValue, ...handlers } = useNumericInput({
1987
+ value,
1988
+ onCommit,
1989
+ allowEmpty: false,
1990
+ min: 0
1991
+ });
1992
+ const { dragProps } = useDragToChange({
1993
+ value,
1994
+ onCommit,
1995
+ min: 0
1996
+ });
1997
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1998
+ "data-re-inspector-number": "",
1999
+ children: [
2000
+ icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2001
+ className: "pointer-events-none",
2002
+ "aria-hidden": true,
2003
+ children: icon
2004
+ }),
2005
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2006
+ type: "text",
2007
+ inputMode: "numeric",
2008
+ "data-type": "number",
2009
+ value: displayValue,
2010
+ ...handlers
2011
+ }),
2012
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2013
+ "data-re-inspector-unit": "",
2014
+ ...dragProps,
2015
+ children: unit
2016
+ })
2017
+ ]
2018
+ });
2019
+ }
2020
+ function expandShorthand(value) {
2021
+ if (typeof value === "number") return {
2022
+ borderTopLeftRadius: value,
2023
+ borderTopRightRadius: value,
2024
+ borderBottomRightRadius: value,
2025
+ borderBottomLeftRadius: value
2026
+ };
2027
+ const [topLeft, topRight, bottomRight, bottomLeft] = value.split(" ").map((v) => Number.parseInt(v, 10));
2028
+ return {
2029
+ borderTopLeftRadius: topLeft,
2030
+ borderTopRightRadius: topRight ?? topLeft,
2031
+ borderBottomRightRadius: bottomRight ?? topLeft,
2032
+ borderBottomLeftRadius: bottomLeft ?? topRight ?? topLeft
2033
+ };
2034
+ }
2035
+ function collapseToShorthand(values) {
2036
+ const { borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius, unit } = values;
2037
+ if (borderTopLeftRadius === borderTopRightRadius && borderTopLeftRadius === borderBottomRightRadius && borderTopLeftRadius === borderBottomLeftRadius) return `${borderTopLeftRadius}${unit}`;
2038
+ if (borderTopLeftRadius === borderBottomRightRadius && borderTopRightRadius === borderBottomLeftRadius) return `${borderTopLeftRadius}${unit} ${borderTopRightRadius}${unit}`;
2039
+ if (borderTopRightRadius === borderBottomLeftRadius) return `${borderTopLeftRadius}${unit} ${borderTopRightRadius}${unit} ${borderBottomRightRadius}${unit}`;
2040
+ return `${borderTopLeftRadius}${unit} ${borderTopRightRadius}${unit} ${borderBottomRightRadius}${unit} ${borderBottomLeftRadius}${unit}`;
2041
+ }
2042
+ //#endregion
2043
+ //#region src/ui/inspector/sections/border.tsx
2044
+ const BORDER_PROPS = [
2045
+ "borderWidth",
2046
+ "borderColor",
2047
+ "borderStyle",
2048
+ "borderTopWidth",
2049
+ "borderTopColor",
2050
+ "borderTopStyle",
2051
+ "borderRightWidth",
2052
+ "borderRightColor",
2053
+ "borderRightStyle",
2054
+ "borderBottomWidth",
2055
+ "borderBottomColor",
2056
+ "borderBottomStyle",
2057
+ "borderLeftWidth",
2058
+ "borderLeftColor",
2059
+ "borderLeftStyle",
2060
+ "borderRadius"
2061
+ ];
2062
+ function BorderSection({ getStyle, setStyle, batchSetStyle }) {
2063
+ const styleObject = {};
2064
+ for (const prop of BORDER_PROPS) styleObject[prop] = getStyle(prop);
2065
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2066
+ title: "Border",
2067
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderPicker, {
2068
+ styleObject,
2069
+ onChange: (propOrChanges, value) => {
2070
+ if (Array.isArray(propOrChanges)) batchSetStyle(propOrChanges.map(([p, v]) => ({
2071
+ prop: p,
2072
+ value: v
2073
+ })));
2074
+ else setStyle(propOrChanges, value);
2075
+ }
2076
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderRadiusPicker, {
2077
+ value: getStyle("borderRadius") ?? 0,
2078
+ onChange: (v) => setStyle("borderRadius", v)
2079
+ })]
2080
+ });
2081
+ }
2082
+ //#endregion
2083
+ //#region src/ui/inspector/components/padding-picker.tsx
2084
+ function PaddingPicker({ value, onChange, unit = "px" }) {
2085
+ const allEqual = value.paddingTop === value.paddingBottom && value.paddingTop === value.paddingLeft && value.paddingTop === value.paddingRight;
2086
+ const [expanded, setExpanded] = react.useState(!allEqual);
2087
+ const handleChange = (key, newValue) => {
2088
+ onChange({
2089
+ paddingTop: value.paddingTop ?? 0,
2090
+ paddingRight: value.paddingRight ?? 0,
2091
+ paddingBottom: value.paddingBottom ?? 0,
2092
+ paddingLeft: value.paddingLeft ?? 0,
2093
+ [key]: newValue
2094
+ });
2095
+ };
2096
+ const handleUniformChange = (newValue) => {
2097
+ onChange({
2098
+ paddingTop: newValue,
2099
+ paddingRight: newValue,
2100
+ paddingBottom: newValue,
2101
+ paddingLeft: newValue
2102
+ });
2103
+ };
2104
+ const handleModeChange = (mode) => {
2105
+ if (mode === "uniform" && expanded) {
2106
+ const uniform = value.paddingTop ?? 0;
2107
+ onChange({
2108
+ paddingTop: uniform,
2109
+ paddingRight: uniform,
2110
+ paddingBottom: uniform,
2111
+ paddingLeft: uniform
2112
+ });
2113
+ setExpanded(false);
2114
+ } else if (mode === "individual" && !expanded) setExpanded(true);
2115
+ };
2116
+ const modeToggle = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
2117
+ value: expanded ? "individual" : "uniform",
2118
+ onValueChange: handleModeChange,
2119
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
2120
+ value: "uniform",
2121
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareIcon, { size: 16 })
2122
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: "Uniform" })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
2123
+ value: "individual",
2124
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SquareDashedIcon, { size: 16 })
2125
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: "Per side" })] })]
2126
+ });
2127
+ if (expanded) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2128
+ className: "flex flex-col gap-2",
2129
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Padding" }), modeToggle] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2130
+ className: "flex flex-col items-center gap-1.5",
2131
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2132
+ className: "flex items-center gap-1",
2133
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingInput, {
2134
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelTopIcon, { size: 14 }),
2135
+ value: value.paddingTop,
2136
+ onChange: (v) => handleChange("paddingTop", v),
2137
+ unit
2138
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingInput, {
2139
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelRightIcon, { size: 14 }),
2140
+ value: value.paddingRight,
2141
+ onChange: (v) => handleChange("paddingRight", v),
2142
+ unit
2143
+ })]
2144
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2145
+ className: "flex items-center gap-1",
2146
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingInput, {
2147
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelBottomIcon, { size: 14 }),
2148
+ value: value.paddingBottom,
2149
+ onChange: (v) => handleChange("paddingBottom", v),
2150
+ unit
2151
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingInput, {
2152
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelLeftIcon, { size: 14 }),
2153
+ value: value.paddingLeft,
2154
+ onChange: (v) => handleChange("paddingLeft", v),
2155
+ unit
2156
+ })]
2157
+ })]
2158
+ })]
2159
+ });
2160
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Padding" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2161
+ className: "flex items-center gap-1",
2162
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingInput, {
2163
+ value: value.paddingTop,
2164
+ onChange: handleUniformChange,
2165
+ unit
2166
+ }), modeToggle]
2167
+ })] });
2168
+ }
2169
+ function PaddingInput({ icon, value, onChange, unit }) {
2170
+ const onCommit = (v) => onChange(v === "" ? 0 : v);
2171
+ const { displayValue, ...handlers } = useNumericInput({
2172
+ value,
2173
+ onCommit,
2174
+ allowEmpty: false,
2175
+ min: 0
2176
+ });
2177
+ const { dragProps } = useDragToChange({
2178
+ value,
2179
+ onCommit,
2180
+ min: 0
2181
+ });
2182
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2183
+ "data-re-inspector-number": "",
2184
+ children: [
2185
+ icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2186
+ className: "pointer-events-none",
2187
+ "aria-hidden": true,
2188
+ children: icon
2189
+ }),
2190
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2191
+ type: "text",
2192
+ inputMode: "numeric",
2193
+ "data-type": "number",
2194
+ value: displayValue,
2195
+ ...handlers
2196
+ }),
2197
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2198
+ "data-re-inspector-unit": "",
2199
+ ...dragProps,
2200
+ children: unit
2201
+ })
2202
+ ]
2203
+ });
2204
+ }
2205
+ //#endregion
2206
+ //#region src/ui/inspector/sections/padding.tsx
2207
+ function PaddingSection({ getStyle, batchSetStyle }) {
2208
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
2209
+ title: "Spacing",
2210
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingPicker, {
2211
+ value: {
2212
+ paddingTop: Number(getStyle("paddingTop")) || 0,
2213
+ paddingRight: Number(getStyle("paddingRight")) || 0,
2214
+ paddingBottom: Number(getStyle("paddingBottom")) || 0,
2215
+ paddingLeft: Number(getStyle("paddingLeft")) || 0
2216
+ },
2217
+ onChange: (values) => {
2218
+ batchSetStyle(Object.entries(values).map(([prop, val]) => ({
2219
+ prop,
2220
+ value: val
2221
+ })));
2222
+ }
2223
+ })
2224
+ });
2225
+ }
2226
+ //#endregion
2227
+ //#region src/ui/inspector/sections/size.tsx
2228
+ const SIZE_AS_ATTRIBUTES = ["image"];
2229
+ function SizeSection({ nodeType, getStyle, setStyle, getAttr, setAttr }) {
2230
+ const useAttrs = SIZE_AS_ATTRIBUTES.includes(nodeType);
2231
+ const width = useAttrs ? getAttr("width") ?? "" : getStyle("width") ?? "";
2232
+ const height = useAttrs ? getAttr("height") ?? "" : getStyle("height") ?? "";
2233
+ const setWidth = (v) => {
2234
+ if (useAttrs) setAttr("width", v === "" ? "" : v);
2235
+ else setStyle("width", v);
2236
+ };
2237
+ const setHeight = (v) => {
2238
+ if (useAttrs) setAttr("height", v === "" ? "" : v);
2239
+ else setStyle("height", v);
2240
+ };
2241
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2242
+ title: "Size",
2243
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Width" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
2244
+ value: width,
2245
+ onChange: setWidth,
2246
+ unit: "px",
2247
+ placeholder: "auto",
2248
+ min: 0
2249
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Height" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
2250
+ value: height,
2251
+ onChange: setHeight,
2252
+ unit: "px",
2253
+ placeholder: "auto",
2254
+ min: 0
2255
+ })] })]
2256
+ });
2257
+ }
2258
+ //#endregion
2259
+ //#region src/ui/inspector/config/text-config.tsx
2260
+ const CSS_UNIT_MAP = {
2261
+ fontSize: "px",
2262
+ borderWidth: "px",
2263
+ borderRadius: "px",
2264
+ paddingTop: "px",
2265
+ paddingRight: "px",
2266
+ paddingBottom: "px",
2267
+ paddingLeft: "px",
2268
+ lineHeight: "%"
2269
+ };
2270
+ const FORMAT_ITEMS = [
2271
+ {
2272
+ value: "bold",
2273
+ icon: require_root.BoldIcon,
2274
+ label: "Bold"
2275
+ },
2276
+ {
2277
+ value: "italic",
2278
+ icon: require_root.ItalicIcon,
2279
+ label: "Italic"
2280
+ },
2281
+ {
2282
+ value: "underline",
2283
+ icon: require_root.UnderlineIcon,
2284
+ label: "Underline"
2285
+ },
2286
+ {
2287
+ value: "line-through",
2288
+ icon: require_root.StrikethroughIcon,
2289
+ label: "Strikethrough"
2290
+ },
2291
+ {
2292
+ value: "code",
2293
+ icon: require_root.CodeIcon,
2294
+ label: "Code"
2295
+ },
2296
+ {
2297
+ value: "uppercase",
2298
+ icon: require_root.CaseUpperIcon,
2299
+ label: "Uppercase"
2300
+ }
2301
+ ];
2302
+ const ALIGNMENT_ITEMS = [
2303
+ {
2304
+ value: "left",
2305
+ alternativeIcon: require_root.AlignLeftIcon,
2306
+ icon: AlignStartVerticalIcon
2307
+ },
2308
+ {
2309
+ value: "center",
2310
+ alternativeIcon: require_root.AlignCenterIcon,
2311
+ icon: AlignCenterVerticalIcon
2312
+ },
2313
+ {
2314
+ value: "right",
2315
+ alternativeIcon: require_root.AlignRightIcon,
2316
+ icon: AlignEndVerticalIcon
2317
+ }
2318
+ ];
2319
+ //#endregion
2320
+ //#region src/ui/inspector/sections/typography.tsx
2321
+ function TypographySection({ getStyle, setStyle, marks, toggleMark, alignment, setAlignment }) {
2322
+ const color = String(getStyle("color") ?? "");
2323
+ const fontSize = getStyle("fontSize") ?? "";
2324
+ const lineHeight = getStyle("lineHeight") ?? "";
2325
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2326
+ title: "Typography",
2327
+ children: [
2328
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Color" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
2329
+ value: color,
2330
+ onChange: (v) => setStyle("color", v)
2331
+ })] }),
2332
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Size" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
2333
+ value: fontSize,
2334
+ onChange: (v) => setStyle("fontSize", v),
2335
+ unit: "px",
2336
+ min: 1
2337
+ })] }),
2338
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Line height" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, {
2339
+ value: lineHeight,
2340
+ onChange: (v) => setStyle("lineHeight", v),
2341
+ unit: "%"
2342
+ })] }),
2343
+ marks && toggleMark && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Format" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2344
+ className: "flex items-center gap-0.5",
2345
+ children: FORMAT_ITEMS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconButton, {
2346
+ onClick: () => toggleMark(item.value),
2347
+ "aria-pressed": marks[item.value] ?? false,
2348
+ "aria-label": item.label,
2349
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(item.icon, { size: 16 })
2350
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: item.label })] }, item.value))
2351
+ })] }),
2352
+ alignment && setAlignment && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Align" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$1, {
2353
+ value: alignment,
2354
+ onValueChange: setAlignment,
2355
+ children: ALIGNMENT_ITEMS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
2356
+ value: item.value,
2357
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(item.icon, { size: 16 })
2358
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: item.value.charAt(0).toUpperCase() + item.value.slice(1) })] }, item.value))
2359
+ })] })
2360
+ ]
2361
+ });
2362
+ }
2363
+ //#endregion
2364
+ //#region src/ui/inspector/utils/resolve-theme-defaults.ts
2365
+ function expandPaddingShorthand(value) {
2366
+ const [top, right = top, bottom = top, left = right] = String(value).trim().split(/\s+/);
2367
+ return {
2368
+ paddingTop: top,
2369
+ paddingRight: right,
2370
+ paddingBottom: bottom,
2371
+ paddingLeft: left
2372
+ };
2373
+ }
2374
+ function parseCssValue(value) {
2375
+ if (value === void 0 || value === null) return null;
2376
+ const match = String(value).trim().match(/^(-?\d*\.?\d+)(px|em|%|rem)?$/);
2377
+ if (match) return {
2378
+ numeric: Number.parseFloat(match[1]),
2379
+ unit: match[2] || ""
2380
+ };
2381
+ return null;
2382
+ }
2383
+ function convertToInspectorUnit(value, bodyFontSize, targetUnit) {
2384
+ const parsed = parseCssValue(value);
2385
+ if (!parsed) return "";
2386
+ if (parsed.unit === "em" || parsed.unit === "rem") return Math.round(parsed.numeric * bodyFontSize);
2387
+ if (parsed.unit === "%") return targetUnit === "%" ? parsed.numeric : parsed.numeric;
2388
+ if (parsed.unit === "px" || parsed.unit === "") return parsed.numeric;
2389
+ return "";
2390
+ }
2391
+ const BASE_FONT_SIZE_PX = 16;
2392
+ function resolveThemeDefaults(nodeType, attrs, themeStyles) {
2393
+ const componentKey = require_extension.getThemeComponentKey(nodeType, 0, attrs);
2394
+ if (!componentKey) return {};
2395
+ const componentStyles = themeStyles[componentKey];
2396
+ if (!componentStyles) return {};
2397
+ const resolvedDefaults = {};
2398
+ if (componentStyles.color) resolvedDefaults.color = componentStyles.color;
2399
+ else if (themeStyles.body?.color) resolvedDefaults.color = themeStyles.body.color;
2400
+ if (componentStyles.fontWeight !== void 0) resolvedDefaults.fontWeight = componentStyles.fontWeight;
2401
+ if (componentStyles.textDecoration !== void 0) resolvedDefaults.textDecoration = componentStyles.textDecoration;
2402
+ if (componentStyles.backgroundColor !== void 0) resolvedDefaults.backgroundColor = componentStyles.backgroundColor;
2403
+ if (componentStyles.borderRadius !== void 0) {
2404
+ const converted = convertToInspectorUnit(componentStyles.borderRadius, BASE_FONT_SIZE_PX, "px");
2405
+ if (converted !== "") resolvedDefaults.borderRadius = converted;
2406
+ }
2407
+ if (componentStyles.borderWidth !== void 0) {
2408
+ const converted = convertToInspectorUnit(componentStyles.borderWidth, BASE_FONT_SIZE_PX, "px");
2409
+ if (converted !== "") resolvedDefaults.borderWidth = converted;
2410
+ }
2411
+ if (componentStyles.borderColor !== void 0) resolvedDefaults.borderColor = componentStyles.borderColor;
2412
+ if (componentStyles.borderStyle !== void 0) resolvedDefaults.borderStyle = componentStyles.borderStyle;
2413
+ const shorthandPadding = componentStyles.padding === void 0 ? {} : expandPaddingShorthand(componentStyles.padding);
2414
+ for (const prop of [
2415
+ "paddingTop",
2416
+ "paddingRight",
2417
+ "paddingBottom",
2418
+ "paddingLeft"
2419
+ ]) {
2420
+ const value = componentStyles[prop] ?? shorthandPadding[prop];
2421
+ if (value !== void 0) {
2422
+ const converted = convertToInspectorUnit(value, BASE_FONT_SIZE_PX, "px");
2423
+ if (converted !== "") resolvedDefaults[prop] = converted;
2424
+ }
2425
+ }
2426
+ return resolvedDefaults;
2427
+ }
2428
+ //#endregion
2429
+ //#region src/ui/inspector/utils/get-node-at-pos.ts
2430
+ function getNodeAtExactPos(editor, nodePos) {
2431
+ const doc = editor.state.doc;
2432
+ const nodeAtPos = doc.nodeAt(nodePos.pos);
2433
+ if (nodeAtPos) return {
2434
+ node: nodeAtPos,
2435
+ pos: nodePos.pos
2436
+ };
2437
+ const resolved = doc.resolve(nodePos.pos);
2438
+ if (resolved.nodeAfter) return {
2439
+ node: resolved.nodeAfter,
2440
+ pos: nodePos.pos
2441
+ };
2442
+ if (resolved.parent && resolved.parent.type.name !== "doc") {
2443
+ const parentPos = resolved.before(resolved.depth);
2444
+ return {
2445
+ node: resolved.parent,
2446
+ pos: parentPos
2447
+ };
2448
+ }
2449
+ return null;
2450
+ }
2451
+ //#endregion
2452
+ //#region src/ui/inspector/utils/style-updates.ts
2453
+ function customUpdateAttributes({ editor, nodePos, prop, newValue }, setLocalAttr) {
2454
+ const result = getNodeAtExactPos(editor, nodePos);
2455
+ if (!result?.node) return;
2456
+ const { node, pos } = result;
2457
+ const attributes = { ...node.attrs };
2458
+ attributes[prop] = newValue;
2459
+ setLocalAttr(attributes);
2460
+ const transaction = editor.state.tr.setNodeMarkup(pos, null, attributes);
2461
+ editor.view.dispatch(transaction);
2462
+ }
2463
+ function customUpdateStyles(params, setLocalAttr) {
2464
+ const result = getNodeAtExactPos(params.editor, params.nodePos);
2465
+ if (!result?.node) return;
2466
+ const { node, pos } = result;
2467
+ const currentStyle = require_email_node.inlineCssToJs(node.attrs.style);
2468
+ const changes = "changes" in params ? params.changes : [[params.prop, params.newValue]];
2469
+ for (const [prop, value] of changes) if (value === "" || value === void 0) delete currentStyle[prop];
2470
+ else {
2471
+ const unit = require_extension.SUPPORTED_CSS_PROPERTIES[prop]?.unit;
2472
+ currentStyle[prop] = unit && typeof value === "number" ? `${value}${unit}` : String(value);
2473
+ }
2474
+ require_email_node.ensureBorderStyleFallback(currentStyle);
2475
+ const newStyle = require_email_node.jsToInlineCss(currentStyle);
2476
+ const attributes = {
2477
+ ...node.attrs,
2478
+ style: newStyle
2479
+ };
2480
+ setLocalAttr(attributes);
2481
+ const transaction = params.editor.state.tr.setNodeMarkup(pos, null, attributes);
2482
+ params.editor.view.dispatch(transaction);
2483
+ }
2484
+ //#endregion
2485
+ //#region src/ui/inspector/node.tsx
2486
+ function InspectorNode({ children }) {
2487
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
2488
+ const theming = require_extension.useEmailTheming(editor);
2489
+ const { target } = useInspector();
2490
+ const documentColors = useDocumentColors(editor);
2491
+ const [localAttr, setLocalAttr] = react.useState(null);
2492
+ const focusedNode = typeof target === "object" && target.nodeType !== "body" ? target : null;
2493
+ react.useEffect(() => {
2494
+ if (focusedNode) setLocalAttr(focusedNode.nodeAttrs);
2495
+ }, [focusedNode]);
2496
+ if (!editor || !theming || !focusedNode) return null;
2497
+ const attrs = localAttr ?? focusedNode.nodeAttrs;
2498
+ const inlineStyles = require_email_node.inlineCssToJs(attrs.style || "");
2499
+ const css = require_extension.stylesToCss(theming.styles, theming.theme);
2500
+ const themeDefaults = resolveThemeDefaults(focusedNode.nodeType, attrs, css);
2501
+ const mergedStyles = {
2502
+ ...themeDefaults,
2503
+ ...inlineStyles
2504
+ };
2505
+ const getStyle = (prop) => mergedStyles[prop];
2506
+ const setStyle = (prop, value) => {
2507
+ customUpdateStyles({
2508
+ editor,
2509
+ nodePos: focusedNode.nodePos,
2510
+ prop,
2511
+ newValue: value
2512
+ }, setLocalAttr);
2513
+ };
2514
+ const batchSetStyle = (changes) => {
2515
+ customUpdateStyles({
2516
+ editor,
2517
+ nodePos: focusedNode.nodePos,
2518
+ changes: changes.map((c) => [c.prop, c.value])
2519
+ }, setLocalAttr);
2520
+ };
2521
+ const getAttr = (name) => attrs[name];
2522
+ const setAttr = (name, value) => {
2523
+ customUpdateAttributes({
2524
+ editor,
2525
+ nodePos: focusedNode.nodePos,
2526
+ prop: name,
2527
+ newValue: value
2528
+ }, setLocalAttr);
2529
+ };
2530
+ const context = {
2531
+ nodeType: focusedNode.nodeType,
2532
+ nodePos: focusedNode.nodePos,
2533
+ getStyle,
2534
+ setStyle,
2535
+ batchSetStyle,
2536
+ getAttr,
2537
+ setAttr,
2538
+ themeDefaults,
2539
+ presetColors: documentColors
2540
+ };
2541
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children(context) });
2542
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorNodeDefaults, { context });
2543
+ }
2544
+ function getDefaultLayout(nodeType) {
2545
+ switch (nodeType) {
2546
+ case "image": return { sections: [
2547
+ { type: "attributes" },
2548
+ { type: "size" },
2549
+ { type: "link" },
2550
+ { type: "padding" },
2551
+ { type: "border" }
2552
+ ] };
2553
+ case "button": return { sections: [
2554
+ { type: "link" },
2555
+ { type: "typography" },
2556
+ { type: "size" },
2557
+ { type: "padding" },
2558
+ { type: "border" },
2559
+ { type: "background" }
2560
+ ] };
2561
+ case "section":
2562
+ case "div": return { sections: [
2563
+ { type: "background" },
2564
+ { type: "padding" },
2565
+ { type: "border" }
2566
+ ] };
2567
+ case "codeBlock": return { sections: [
2568
+ { type: "attributes" },
2569
+ { type: "padding" },
2570
+ { type: "border" }
2571
+ ] };
2572
+ case "footer": return { sections: [
2573
+ { type: "typography" },
2574
+ { type: "padding" },
2575
+ { type: "background" }
2576
+ ] };
2577
+ default: return { sections: [
2578
+ { type: "typography" },
2579
+ { type: "padding" },
2580
+ { type: "background" },
2581
+ { type: "border" }
2582
+ ] };
2583
+ }
2584
+ }
2585
+ function InspectorNodeDefaults({ context }) {
2586
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: getDefaultLayout(context.nodeType).sections.map((section) => {
2587
+ switch (section.type) {
2588
+ case "attributes": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AttributesSection, { ...context }, section.type);
2589
+ case "size": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SizeSection, { ...context }, section.type);
2590
+ case "typography": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypographySection, { ...context }, section.type);
2591
+ case "padding": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaddingSection, { ...context }, section.type);
2592
+ case "background": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BackgroundSection, { ...context }, section.type);
2593
+ case "border": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderSection, { ...context }, section.type);
2594
+ default: return null;
2595
+ }
2596
+ }) });
2597
+ }
2598
+ //#endregion
2599
+ //#region src/ui/inspector/sections/link.tsx
2600
+ function LinkSection({ linkHref, linkColor, setLinkColor, isLinkActive }) {
2601
+ if (!isLinkActive) return null;
2602
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2603
+ title: "Link",
2604
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "URL" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2605
+ type: "text",
2606
+ value: linkHref,
2607
+ readOnly: true
2608
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PropRow, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, { children: "Color" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorInput, {
2609
+ value: linkColor,
2610
+ onChange: setLinkColor
2611
+ })] })]
2612
+ });
2613
+ }
2614
+ //#endregion
2615
+ //#region src/ui/inspector/hooks/use-link-mark.ts
2616
+ function useLinkMark(editor) {
2617
+ return (0, _tiptap_react.useEditorState)({
2618
+ editor,
2619
+ selector: ({ editor }) => {
2620
+ if (!editor) return {
2621
+ href: "",
2622
+ style: "",
2623
+ isActive: false
2624
+ };
2625
+ const { from } = editor.state.selection;
2626
+ const mark = editor.state.doc.resolve(from).marks().find((m) => m.type.name === "link") ?? null;
2627
+ return {
2628
+ href: mark?.attrs?.href ?? "",
2629
+ style: mark?.attrs?.style ?? "",
2630
+ isActive: !!mark
2631
+ };
2632
+ }
2633
+ }) ?? {
2634
+ href: "",
2635
+ style: "",
2636
+ isActive: false
2637
+ };
2638
+ }
2639
+ function getLinkColor(linkStyle, themeLinkColor, fallback = "#000000") {
2640
+ return require_email_node.inlineCssToJs(linkStyle).color || themeLinkColor || fallback;
2641
+ }
2642
+ function updateLinkColor(editor, linkStyle, color) {
2643
+ const styleObj = require_email_node.inlineCssToJs(linkStyle);
2644
+ styleObj.color = color;
2645
+ const newStyle = require_email_node.jsToInlineCss(styleObj);
2646
+ const { from, to } = editor.state.selection;
2647
+ editor.chain().extendMarkRange("link").updateAttributes("link", { style: newStyle }).setTextSelection({
2648
+ from,
2649
+ to
2650
+ }).run();
2651
+ }
2652
+ //#endregion
2653
+ //#region src/ui/inspector/utils/text-block-utils.ts
2654
+ function getParentBlockInfo(editor) {
2655
+ if (!editor) return {
2656
+ alignment: "left",
2657
+ pos: 0,
2658
+ nodeType: "paragraph",
2659
+ attrs: {}
2660
+ };
2661
+ const { from } = editor.state.selection;
2662
+ const resolvedPos = editor.state.doc.resolve(from);
2663
+ for (let depth = resolvedPos.depth; depth > 0; depth--) {
2664
+ const node = resolvedPos.node(depth);
2665
+ if (node.isBlock) return {
2666
+ alignment: node.attrs.align || node.attrs.alignment || "left",
2667
+ pos: resolvedPos.before(depth),
2668
+ nodeType: node.type.name,
2669
+ attrs: { ...node.attrs }
2670
+ };
2671
+ }
2672
+ return {
2673
+ alignment: "left",
2674
+ pos: 0,
2675
+ nodeType: "paragraph",
2676
+ attrs: {}
2677
+ };
2678
+ }
2679
+ function updateParentBlockStyle(editor, parentPos, styleKeyOrChanges, value) {
2680
+ if (!editor || parentPos < 0) return;
2681
+ const node = editor.state.doc.nodeAt(parentPos);
2682
+ if (!node) return;
2683
+ const expanded = require_email_node.expandShorthandProperties(require_email_node.inlineCssToJs(node.attrs.style || "", { removeUnit: false }));
2684
+ const changes = Array.isArray(styleKeyOrChanges) ? styleKeyOrChanges : [[styleKeyOrChanges, value]];
2685
+ for (const [styleKey, v] of changes) if (v === "" || v === void 0) delete expanded[styleKey];
2686
+ else {
2687
+ const unit = CSS_UNIT_MAP[styleKey];
2688
+ expanded[styleKey] = unit && typeof v === "number" ? `${v}${unit}` : v;
2689
+ }
2690
+ require_email_node.ensureBorderStyleFallback(expanded);
2691
+ const newStyle = require_email_node.jsToInlineCss(expanded);
2692
+ const tr = editor.state.tr.setNodeMarkup(parentPos, null, {
2693
+ ...node.attrs,
2694
+ style: newStyle
2695
+ });
2696
+ editor.view.dispatch(tr);
2697
+ }
2698
+ //#endregion
2699
+ //#region src/ui/inspector/text.tsx
2700
+ const MARK_NAMES = [
2701
+ "bold",
2702
+ "italic",
2703
+ "underline",
2704
+ "strike",
2705
+ "code"
2706
+ ];
2707
+ function InspectorText({ children }) {
2708
+ const { editor } = (0, _tiptap_react.useCurrentEditor)();
2709
+ const theming = require_extension.useEmailTheming(editor);
2710
+ const { target } = useInspector();
2711
+ const documentColors = useDocumentColors(editor);
2712
+ const linkMark = useLinkMark(editor);
2713
+ const activeMarks = (0, _tiptap_react.useEditorState)({
2714
+ editor,
2715
+ selector: ({ editor: ed }) => {
2716
+ if (!ed) return {};
2717
+ const result = {};
2718
+ for (const mark of MARK_NAMES) result[mark] = ed.isActive(mark);
2719
+ return result;
2720
+ }
2721
+ }) ?? {};
2722
+ const parentBlock = (0, _tiptap_react.useEditorState)({
2723
+ editor,
2724
+ selector: ({ editor: ed }) => getParentBlockInfo(ed)
2725
+ });
2726
+ if (!editor || !theming || target !== "text") return null;
2727
+ const css = require_extension.stylesToCss(theming.styles, theming.theme);
2728
+ const parentAttrs = parentBlock?.attrs ?? {};
2729
+ const parentNodeType = parentBlock?.nodeType ?? "paragraph";
2730
+ const parentPos = parentBlock?.pos ?? 0;
2731
+ const themeDefaults = resolveThemeDefaults(parentNodeType, parentAttrs, css);
2732
+ const parentStyle = require_email_node.inlineCssToJs(String(parentAttrs.style || ""));
2733
+ const mergedStyles = {
2734
+ ...themeDefaults,
2735
+ ...parentStyle
2736
+ };
2737
+ const themeLinkColor = css.link?.color ? String(css.link.color) : void 0;
2738
+ const context = {
2739
+ marks: activeMarks,
2740
+ toggleMark: (mark) => {
2741
+ editor.chain().focus().toggleMark(mark).run();
2742
+ },
2743
+ alignment: parentBlock?.alignment ?? "left",
2744
+ setAlignment: (value) => {
2745
+ if (!parentBlock) return;
2746
+ editor.chain().focus().updateAttributes(parentNodeType, { alignment: value }).run();
2747
+ },
2748
+ linkHref: linkMark.href,
2749
+ linkColor: getLinkColor(linkMark.style, themeLinkColor),
2750
+ setLinkColor: (color) => {
2751
+ updateLinkColor(editor, linkMark.style, color);
2752
+ },
2753
+ isLinkActive: linkMark.isActive,
2754
+ getStyle: (prop) => mergedStyles[prop],
2755
+ setStyle: (prop, value) => {
2756
+ updateParentBlockStyle(editor, parentPos, prop, value);
2757
+ },
2758
+ presetColors: documentColors
2759
+ };
2760
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children(context) });
2761
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorTextDefaults, { context });
2762
+ }
2763
+ function InspectorTextDefaults({ context }) {
2764
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypographySection, { ...context }), context.isLinkActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkSection, { ...context })] });
2765
+ }
2766
+ //#endregion
2767
+ //#region src/ui/inspector/index.tsx
2768
+ const Inspector = {
2769
+ Root: InspectorRoot,
2770
+ Breadcrumb: InspectorBreadcrumb,
2771
+ Document: InspectorDocument,
2772
+ Node: InspectorNode,
2773
+ Text: InspectorText,
2774
+ Attributes: AttributesSection,
2775
+ Background: BackgroundSection,
2776
+ Border: BorderSection,
2777
+ Link: LinkSection,
2778
+ Padding: PaddingSection,
2779
+ Size: SizeSection,
2780
+ Typography: TypographySection
2781
+ };
2782
+ //#endregion
2783
+ exports.AlignCenterIcon = require_root.AlignCenterIcon;
2784
+ exports.AlignCenterVerticalIcon = AlignCenterVerticalIcon;
2785
+ exports.AlignEndVerticalIcon = AlignEndVerticalIcon;
2786
+ exports.AlignLeftIcon = require_root.AlignLeftIcon;
2787
+ exports.AlignRightIcon = require_root.AlignRightIcon;
2788
+ exports.AlignStartVerticalIcon = AlignStartVerticalIcon;
2789
+ exports.BULLET_LIST = require_root.BULLET_LIST;
2790
+ exports.BUTTON = require_root.BUTTON;
2791
+ exports.BoldIcon = require_root.BoldIcon;
2792
+ exports.BoxIcon = BoxIcon;
2793
+ exports.BubbleMenu = require_root.BubbleMenu;
2794
+ exports.BubbleMenuAlignCenter = require_root.BubbleMenuAlignCenter;
2795
+ exports.BubbleMenuAlignLeft = require_root.BubbleMenuAlignLeft;
2796
+ exports.BubbleMenuAlignRight = require_root.BubbleMenuAlignRight;
2797
+ exports.BubbleMenuBold = require_root.BubbleMenuBold;
2798
+ exports.BubbleMenuButtonDefault = require_root.BubbleMenuButtonDefault;
2799
+ exports.BubbleMenuButtonEditLink = require_root.BubbleMenuButtonEditLink;
2800
+ exports.BubbleMenuButtonForm = require_root.BubbleMenuButtonForm;
2801
+ exports.BubbleMenuButtonToolbar = require_root.BubbleMenuButtonToolbar;
2802
+ exports.BubbleMenuButtonUnlink = require_root.BubbleMenuButtonUnlink;
2803
+ exports.BubbleMenuCode = require_root.BubbleMenuCode;
2804
+ exports.BubbleMenuImageDefault = require_root.BubbleMenuImageDefault;
2805
+ exports.BubbleMenuImageEditLink = require_root.BubbleMenuImageEditLink;
2806
+ exports.BubbleMenuImageToolbar = require_root.BubbleMenuImageToolbar;
2807
+ exports.BubbleMenuItalic = require_root.BubbleMenuItalic;
2808
+ exports.BubbleMenuItem = require_root.BubbleMenuItem;
2809
+ exports.BubbleMenuItemGroup = require_root.BubbleMenuItemGroup;
2810
+ exports.BubbleMenuLinkDefault = require_root.BubbleMenuLinkDefault;
2811
+ exports.BubbleMenuLinkEditLink = require_root.BubbleMenuLinkEditLink;
2812
+ exports.BubbleMenuLinkForm = require_root.BubbleMenuLinkForm;
2813
+ exports.BubbleMenuLinkOpenLink = require_root.BubbleMenuLinkOpenLink;
2814
+ exports.BubbleMenuLinkSelector = require_root.BubbleMenuLinkSelector;
2815
+ exports.BubbleMenuLinkToolbar = require_root.BubbleMenuLinkToolbar;
2816
+ exports.BubbleMenuLinkUnlink = require_root.BubbleMenuLinkUnlink;
2817
+ exports.BubbleMenuNodeSelector = require_root.BubbleMenuNodeSelector;
2818
+ exports.BubbleMenuRoot = require_root.RootWithDefault;
2819
+ exports.BubbleMenuSeparator = require_root.BubbleMenuSeparator;
2820
+ exports.BubbleMenuStrike = require_root.BubbleMenuStrike;
2821
+ exports.BubbleMenuUnderline = require_root.BubbleMenuUnderline;
2822
+ exports.BubbleMenuUppercase = require_root.BubbleMenuUppercase;
2823
+ exports.CODE = require_root.CODE;
2824
+ exports.CaseUpperIcon = require_root.CaseUpperIcon;
2825
+ exports.CheckIcon = require_root.CheckIcon;
2826
+ exports.ChevronDownIcon = require_root.ChevronDownIcon;
2827
+ exports.CodeIcon = require_root.CodeIcon;
2828
+ exports.Columns2Icon = require_root.Columns2Icon;
2829
+ exports.Columns3Icon = require_root.Columns3Icon;
2830
+ exports.Columns4Icon = require_root.Columns4Icon;
2831
+ exports.CornerBottomLeftIcon = CornerBottomLeftIcon;
2832
+ exports.CornerBottomRightIcon = CornerBottomRightIcon;
2833
+ exports.CornerTopLeftIcon = CornerTopLeftIcon;
2834
+ exports.CornerTopRightIcon = CornerTopRightIcon;
2835
+ exports.DIVIDER = require_root.DIVIDER;
2836
+ exports.EditorFocusScope = EditorFocusScope;
2837
+ exports.EditorFocusScopeProvider = EditorFocusScopeProvider;
2838
+ exports.ExternalLinkIcon = require_root.ExternalLinkIcon;
2839
+ exports.FOUR_COLUMNS = require_root.FOUR_COLUMNS;
2840
+ exports.FocusScopeContext = FocusScopeContext;
2841
+ exports.H1 = require_root.H1;
2842
+ exports.H2 = require_root.H2;
2843
+ exports.H3 = require_root.H3;
2844
+ exports.Heading1Icon = require_root.Heading1Icon;
2845
+ exports.Heading2Icon = require_root.Heading2Icon;
2846
+ exports.Heading3Icon = require_root.Heading3Icon;
2847
+ exports.ImageIcon = require_image.ImageIcon;
2848
+ exports.Inspector = Inspector;
2849
+ exports.ItalicIcon = require_root.ItalicIcon;
2850
+ exports.LayoutIcon = LayoutIcon;
2851
+ exports.LinkIcon = require_root.LinkIcon;
2852
+ exports.ListIcon = require_root.ListIcon;
2853
+ exports.ListOrderedIcon = require_root.ListOrderedIcon;
2854
+ exports.MinusIcon = MinusIcon;
2855
+ exports.MousePointerClickIcon = MousePointerClickIcon;
2856
+ exports.MousePointerIcon = require_root.MousePointerIcon;
2857
+ exports.NUMBERED_LIST = require_root.NUMBERED_LIST;
2858
+ exports.NodeSelectorContent = require_root.NodeSelectorContent;
2859
+ exports.NodeSelectorRoot = require_root.NodeSelectorRoot;
2860
+ exports.NodeSelectorTrigger = require_root.NodeSelectorTrigger;
2861
+ exports.PanelBottomIcon = PanelBottomIcon;
2862
+ exports.PanelLeftIcon = PanelLeftIcon;
2863
+ exports.PanelRightIcon = PanelRightIcon;
2864
+ exports.PanelTopIcon = PanelTopIcon;
2865
+ exports.PencilIcon = require_root.PencilIcon;
2866
+ exports.PlusIcon = PlusIcon;
2867
+ exports.QUOTE = require_root.QUOTE;
2868
+ exports.Rows2Icon = require_root.Rows2Icon;
2869
+ exports.SECTION = require_root.SECTION;
2870
+ exports.SlashCommand = require_root.SlashCommandRoot;
2871
+ exports.SplitSquareVerticalIcon = require_root.SplitSquareVerticalIcon;
2872
+ exports.SquareCodeIcon = require_root.SquareCodeIcon;
2873
+ exports.SquareDashedIcon = SquareDashedIcon;
2874
+ exports.SquareIcon = SquareIcon;
2875
+ exports.SquareRoundCornerIcon = SquareRoundCornerIcon;
2876
+ exports.StrikethroughIcon = require_root.StrikethroughIcon;
2877
+ exports.TEXT = require_root.TEXT;
2878
+ exports.THREE_COLUMNS = require_root.THREE_COLUMNS;
2879
+ exports.TWO_COLUMNS = require_root.TWO_COLUMNS;
2880
+ exports.TableIcon = TableIcon;
2881
+ exports.TextIcon = require_root.TextIcon;
2882
+ exports.TextQuoteIcon = require_root.TextQuoteIcon;
2883
+ exports.TypeIcon = TypeIcon;
2884
+ exports.UnderlineIcon = require_root.UnderlineIcon;
2885
+ exports.UnlinkIcon = require_root.UnlinkIcon;
2886
+ exports.XIcon = XIcon;
2887
+ exports.bubbleMenuTriggers = require_root.bubbleMenuTriggers;
2888
+ exports.defaultSlashCommands = require_root.defaultSlashCommands;
2889
+ exports.filterAndRankItems = require_root.filterAndRankItems;
2890
+ exports.getNodeMeta = getNodeMeta;
2891
+ exports.isAtMaxColumnsDepth = require_root.isAtMaxColumnsDepth;
2892
+ exports.isInsideNode = require_root.isInsideNode;
2893
+ exports.scoreItem = require_root.scoreItem;
2894
+ exports.useBubbleMenuContext = require_root.useBubbleMenuContext;
2895
+ exports.useEditorFocusScope = useEditorFocusScope;