@react-email/editor 0.0.0-experimental.42 → 0.0.0-experimental.44

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