@emabuild/core 0.1.5 → 0.2.0

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 (40) hide show
  1. package/dist/canvas/content-renderer.d.ts +5 -2
  2. package/dist/canvas/content-renderer.d.ts.map +1 -1
  3. package/dist/{form-tool-CduLiZgt.js → form-tool-DdFDrS3b.js} +10 -10
  4. package/dist/form-tool-DdFDrS3b.js.map +1 -0
  5. package/dist/{html-tool-D4ay2h-U.js → html-tool-DMtmrF3n.js} +3 -3
  6. package/dist/{html-tool-D4ay2h-U.js.map → html-tool-DMtmrF3n.js.map} +1 -1
  7. package/dist/{index-BoKIXJKv.js → index-CpMbWdgn.js} +318 -227
  8. package/dist/index-CpMbWdgn.js.map +1 -0
  9. package/dist/index.js +1 -1
  10. package/dist/mail-editor.d.ts.map +1 -1
  11. package/dist/{menu-tool-KvGDbaYD.js → menu-tool-CJcQdpcP.js} +10 -10
  12. package/dist/menu-tool-CJcQdpcP.js.map +1 -0
  13. package/dist/properties/property-panel.d.ts.map +1 -1
  14. package/dist/properties/widgets/index.d.ts +1 -0
  15. package/dist/properties/widgets/index.d.ts.map +1 -1
  16. package/dist/properties/widgets/number-unit-widget.d.ts +10 -0
  17. package/dist/properties/widgets/number-unit-widget.d.ts.map +1 -0
  18. package/dist/{social-tool-B8Jg2yE-.js → social-tool-CRY3-_sU.js} +8 -8
  19. package/dist/social-tool-CRY3-_sU.js.map +1 -0
  20. package/dist/{table-tool-BzpD08dq.js → table-tool-DeIQci5z.js} +8 -8
  21. package/dist/table-tool-DeIQci5z.js.map +1 -0
  22. package/dist/{timer-tool-Ck1ERDW-.js → timer-tool-BVE1shO1.js} +6 -6
  23. package/dist/timer-tool-BVE1shO1.js.map +1 -0
  24. package/dist/tools/built-in/button-tool.d.ts.map +1 -1
  25. package/dist/tools/built-in/heading-tool.d.ts.map +1 -1
  26. package/dist/tools/built-in/image-tool.d.ts.map +1 -1
  27. package/dist/tools/helpers/index.d.ts +1 -1
  28. package/dist/tools/helpers/index.d.ts.map +1 -1
  29. package/dist/tools/helpers/value-extractor.d.ts +9 -0
  30. package/dist/tools/helpers/value-extractor.d.ts.map +1 -1
  31. package/dist/{video-tool-CdGVmZxz.js → video-tool-g1fIoCWW.js} +3 -3
  32. package/dist/video-tool-g1fIoCWW.js.map +1 -0
  33. package/package.json +3 -3
  34. package/dist/form-tool-CduLiZgt.js.map +0 -1
  35. package/dist/index-BoKIXJKv.js.map +0 -1
  36. package/dist/menu-tool-KvGDbaYD.js.map +0 -1
  37. package/dist/social-tool-B8Jg2yE-.js.map +0 -1
  38. package/dist/table-tool-BzpD08dq.js.map +0 -1
  39. package/dist/timer-tool-Ck1ERDW-.js.map +0 -1
  40. package/dist/video-tool-CdGVmZxz.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { html as p, LitElement as $, css as k } from "lit";
2
- import { property as b, customElement as C, state as pt } from "lit/decorators.js";
2
+ import { property as b, customElement as C, state as ht } from "lit/decorators.js";
3
3
  import { unsafeHTML as U } from "lit/directives/unsafe-html.js";
4
- import { styleMap as ht } from "lit/directives/style-map.js";
5
- function ut() {
4
+ import { styleMap as ut } from "lit/directives/style-map.js";
5
+ function gt() {
6
6
  const e = {};
7
7
  return {
8
8
  getCounters() {
@@ -19,7 +19,7 @@ function ut() {
19
19
  }
20
20
  };
21
21
  }
22
- class gt {
22
+ class ft {
23
23
  constructor() {
24
24
  this.listeners = /* @__PURE__ */ new Map();
25
25
  }
@@ -46,7 +46,7 @@ class gt {
46
46
  t ? this.listeners.delete(t) : this.listeners.clear();
47
47
  }
48
48
  }
49
- class ft {
49
+ class bt {
50
50
  constructor(t = 50) {
51
51
  this.undoStack = [], this.redoStack = [], this.maxHistory = t;
52
52
  }
@@ -79,7 +79,7 @@ class ft {
79
79
  this.undoStack = [], this.redoStack = [];
80
80
  }
81
81
  }
82
- function bt() {
82
+ function mt() {
83
83
  return {
84
84
  counters: { u_row: 0, u_column: 0 },
85
85
  body: {
@@ -124,7 +124,7 @@ function bt() {
124
124
  schemaVersion: 16
125
125
  };
126
126
  }
127
- function mt(e, t) {
127
+ function xt(e, t) {
128
128
  const o = e.next("u_row"), n = t.map(() => {
129
129
  const i = e.next("u_column");
130
130
  return {
@@ -157,7 +157,7 @@ function mt(e, t) {
157
157
  }
158
158
  };
159
159
  }
160
- function xt(e, t, o = {}) {
160
+ function yt(e, t, o = {}) {
161
161
  const n = e.next(`u_content_${t}`), i = `u_content_${t}_${n}`;
162
162
  return {
163
163
  id: i,
@@ -189,21 +189,21 @@ function W(e, t) {
189
189
  if (i) return i;
190
190
  }
191
191
  }
192
- function yt(e, t) {
192
+ function wt(e, t) {
193
193
  for (const o of e.body.rows)
194
194
  for (const n of o.columns)
195
195
  if (n.contents.some((i) => i.id === t)) return n;
196
196
  }
197
- function wt(e, t) {
197
+ function vt(e, t) {
198
198
  for (const o of e.body.rows)
199
199
  if (o.columns.some((n) => n.id === t)) return o;
200
200
  }
201
201
  function q(e, t) {
202
202
  return e.body.rows.findIndex((o) => o.id === t);
203
203
  }
204
- class vt {
204
+ class $t {
205
205
  constructor() {
206
- this.history = new ft(), this.counterManager = ut(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new gt(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = bt();
206
+ this.history = new bt(), this.counterManager = gt(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new ft(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = mt();
207
207
  }
208
208
  // ── Subscriptions ──────────────────────────────────────────
209
209
  /** Subscribe to ALL state changes (legacy). Returns an unsubscribe function. */
@@ -427,20 +427,20 @@ class vt {
427
427
  return W(this.design, t);
428
428
  }
429
429
  findParentColumn(t) {
430
- return yt(this.design, t);
430
+ return wt(this.design, t);
431
431
  }
432
432
  findParentRow(t) {
433
- return wt(this.design, t);
433
+ return vt(this.design, t);
434
434
  }
435
435
  // ── Factory Methods (delegate to design-factory) ───────────
436
436
  /** Create a new row with the given column layout */
437
437
  createRow(t) {
438
- const o = mt(this.counterManager, t);
438
+ const o = xt(this.counterManager, t);
439
439
  return this.syncCounters(), o;
440
440
  }
441
441
  /** Create a new content block for the given tool type */
442
442
  createContent(t, o = {}) {
443
- const n = xt(this.counterManager, t, o);
443
+ const n = yt(this.counterManager, t, o);
444
444
  return this.syncCounters(), n;
445
445
  }
446
446
  // ── Private Helpers ────────────────────────────────────────
@@ -451,7 +451,7 @@ class vt {
451
451
  this.events.emit("design:updated", { type: t, item: o });
452
452
  }
453
453
  }
454
- class $t {
454
+ class kt {
455
455
  constructor() {
456
456
  this.tools = /* @__PURE__ */ new Map(), this.lazyLoaders = /* @__PURE__ */ new Map(), this.lazyMeta = /* @__PURE__ */ new Map(), this.loadingPromises = /* @__PURE__ */ new Map();
457
457
  }
@@ -589,7 +589,7 @@ function et(e, t) {
589
589
  n.matches?.(t) && o.push(n);
590
590
  }), o;
591
591
  }
592
- class kt {
592
+ class Ct {
593
593
  constructor(t, o, n) {
594
594
  this.currentDrop = null, this.contentIndicator = null, this.rowIndicator = null, this.onDragOver = (i) => {
595
595
  const s = i.dataTransfer?.types || [], r = s.includes("application/maileditor-tool"), a = s.includes("application/maileditor-layout"), d = s.includes("application/maileditor-content") || !!L.draggingContentId;
@@ -673,7 +673,7 @@ class kt {
673
673
  let g = Math.abs(o - h);
674
674
  g < s && (s = g, i = { type: "content", columnId: a, contentIndex: 0, y: h });
675
675
  for (let u = 0; u < c.length; u++) {
676
- const f = c[u].getBoundingClientRect(), y = c[u + 1]?.getBoundingClientRect(), x = y ? (f.bottom + y.top) / 2 : f.bottom;
676
+ const f = c[u].getBoundingClientRect(), w = c[u + 1]?.getBoundingClientRect(), x = w ? (f.bottom + w.top) / 2 : f.bottom;
677
677
  g = Math.abs(o - x), g < s && (s = g, i = { type: "content", columnId: a, contentIndex: u + 1, y: x });
678
678
  }
679
679
  }
@@ -724,7 +724,7 @@ function nt(e) {
724
724
  }
725
725
  return {};
726
726
  }
727
- function Ct(e) {
727
+ function _t(e) {
728
728
  const t = e.action;
729
729
  if (t && typeof t == "object") {
730
730
  const o = t.values;
@@ -770,7 +770,21 @@ function Y(e, t = "arial,helvetica,sans-serif") {
770
770
  }
771
771
  return t;
772
772
  }
773
- function ye(e, t) {
773
+ function st(e) {
774
+ const t = e.buttonColors;
775
+ if (t && typeof t == "object") {
776
+ const o = t;
777
+ return {
778
+ bg: o.backgroundColor || l(e, "backgroundColor", "#3b82f6"),
779
+ color: o.color || l(e, "textColor", "#ffffff")
780
+ };
781
+ }
782
+ return {
783
+ bg: l(e, "backgroundColor", "#3b82f6"),
784
+ color: l(e, "textColor", "#ffffff")
785
+ };
786
+ }
787
+ function ve(e, t) {
774
788
  if (typeof e != "string") return t;
775
789
  try {
776
790
  return JSON.parse(e);
@@ -786,7 +800,7 @@ function z(e, t) {
786
800
  </td></tr></tbody>
787
801
  </table>`;
788
802
  }
789
- function _t(e, t, o) {
803
+ function St(e, t, o) {
790
804
  const { bgColor: n, textColor: i, fontSize: s, fontWeight: r, borderRadius: a } = o, d = parseInt(a) || 0;
791
805
  if (d <= 0) return "";
792
806
  const c = Math.round(d / 20 * 100);
@@ -860,9 +874,9 @@ const Dt = {
860
874
  },
861
875
  renderer: {
862
876
  renderEditor(e) {
863
- const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "transparent"), n = l(e, "color", "inherit"), i = l(e, "lineHeight", "140%"), s = Y(e), r = l(e, "text");
877
+ const t = l(e, "backgroundColor", "transparent"), o = l(e, "color", "inherit"), n = l(e, "lineHeight", "140%"), i = l(e, "textAlign", "left"), s = Y(e), r = l(e, "text");
864
878
  return p`
865
- <div style="padding:${t};background-color:${o};color:${n};line-height:${i};font-family:${s};word-break:break-word;">
879
+ <div style="background-color:${t};color:${o};line-height:${n};text-align:${i};font-family:${s};">
866
880
  ${U(r)}
867
881
  </div>
868
882
  `;
@@ -873,7 +887,7 @@ const Dt = {
873
887
  }
874
888
  }
875
889
  };
876
- const St = {
890
+ const Rt = {
877
891
  name: "heading",
878
892
  label: "Heading",
879
893
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h12"/><path d="M6 4v16"/><path d="M18 4v16"/></svg>',
@@ -945,7 +959,12 @@ const St = {
945
959
  { label: "200%", value: "200%" }
946
960
  ] }
947
961
  },
948
- letterSpacing: { label: "Letter Spacing", defaultValue: "normal", widget: "text" }
962
+ letterSpacing: {
963
+ label: "Letter Spacing",
964
+ defaultValue: "0px",
965
+ widget: "number_unit",
966
+ widgetParams: { unit: "px", min: -5, max: 50, step: 0.1 }
967
+ }
949
968
  }
950
969
  },
951
970
  spacing: {
@@ -971,7 +990,7 @@ const St = {
971
990
  textAlign: "left",
972
991
  fontWeight: "700",
973
992
  lineHeight: "140%",
974
- letterSpacing: "normal",
993
+ letterSpacing: "0px",
975
994
  containerPadding: "10px"
976
995
  },
977
996
  renderer: {
@@ -986,14 +1005,14 @@ const St = {
986
1005
  letterSpacing: l(e, "letterSpacing", "normal"),
987
1006
  fontFamily: Y(e)
988
1007
  }, o = it(e, "Heading");
989
- return p`<div style=${ht(t)}>${U(o)}</div>`;
1008
+ return p`<div style=${ut(t)}>${U(o)}</div>`;
990
1009
  },
991
1010
  renderHtml(e) {
992
1011
  const t = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), s = l(e, "fontWeight", "700"), r = l(e, "lineHeight", "140%"), a = l(e, "letterSpacing", "normal"), d = Y(e), c = l(e, "headingType", "h1"), h = it(e, "Heading"), g = `<${c} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${s};line-height:${r};letter-spacing:${a};font-family:${d};">${h}</${c}>`;
993
1012
  return z(g, { padding: t });
994
1013
  }
995
1014
  }
996
- }, Rt = {
1015
+ }, Tt = {
997
1016
  name: "paragraph",
998
1017
  label: "Paragraph",
999
1018
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/><line x1="3" y1="14" x2="17" y2="14"/></svg>',
@@ -1036,15 +1055,15 @@ const St = {
1036
1055
  },
1037
1056
  renderer: {
1038
1057
  renderEditor(e) {
1039
- const t = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%");
1040
- return p`<div style="padding:${t};color:${o};line-height:${n};word-break:break-word;">${U(l(e, "text"))}</div>`;
1058
+ const t = l(e, "color", "#374151"), o = l(e, "lineHeight", "160%"), n = l(e, "textAlign", "left");
1059
+ return p`<div style="color:${t};line-height:${o};text-align:${n};">${U(l(e, "text"))}</div>`;
1041
1060
  },
1042
1061
  renderHtml(e) {
1043
1062
  const t = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%"), i = l(e, "textAlign", "left"), s = l(e, "letterSpacing", "normal"), r = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${s};word-wrap:break-word;">${l(e, "text")}</div>`;
1044
1063
  return z(r, { padding: t });
1045
1064
  }
1046
1065
  }
1047
- }, Tt = {
1066
+ }, It = {
1048
1067
  name: "image",
1049
1068
  label: "Image",
1050
1069
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
@@ -1105,18 +1124,18 @@ const St = {
1105
1124
  },
1106
1125
  renderer: {
1107
1126
  renderEditor(e) {
1108
- const t = l(e, "containerPadding", "10px"), o = ot(e.src), n = l(e, "alt"), s = nt(e.src).maxWidth || l(e, "width", "100%"), r = l(e, "borderRadius", "0px"), a = l(e, "textAlign", l(e, "align", "center"));
1109
- return o ? p`<div style="padding:${t};text-align:${a};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${s};border-radius:${r};border:0;" /></div>` : p`<div style="padding:${t};text-align:${a};"><div style="background:#f1f5f9;border:2px dashed #cbd5e1;border-radius:8px;padding:40px 20px;text-align:center;color:#94a3b8;font-size:13px;">No image set. Enter a URL in the property panel.</div></div>`;
1127
+ const t = ot(e.src), o = l(e, "alt"), i = nt(e.src).maxWidth || l(e, "width", "100%"), s = l(e, "borderRadius", "0px"), r = l(e, "textAlign", l(e, "align", "center"));
1128
+ return t ? p`<div style="text-align:${r};"><img src=${t} alt=${o} style="display:inline-block;max-width:100%;width:${i};border-radius:${s};border:0;" /></div>` : p`<div style="text-align:${r};"><div style="background:#f1f5f9;border:2px dashed #cbd5e1;border-radius:8px;padding:40px 20px;text-align:center;color:#94a3b8;font-size:13px;">No image set. Enter a URL in the property panel.</div></div>`;
1110
1129
  },
1111
1130
  renderHtml(e, t) {
1112
- const o = l(e, "containerPadding", "10px"), n = ot(e.src), i = l(e, "alt"), s = Ct(e), r = nt(e.src), a = r.maxWidth || l(e, "width", "100%"), d = l(e, "borderRadius", "0px"), c = l(e, "textAlign", l(e, "align", "center"));
1131
+ const o = l(e, "containerPadding", "10px"), n = ot(e.src), i = l(e, "alt"), s = _t(e), r = nt(e.src), a = r.maxWidth || l(e, "width", "100%"), d = l(e, "borderRadius", "0px"), c = l(e, "textAlign", l(e, "align", "center"));
1113
1132
  let h;
1114
1133
  a.includes("%") ? h = Math.round(t.columnWidth * (parseFloat(a) / 100)) : a === "auto" ? h = r.width || t.columnWidth : h = parseInt(a) || t.columnWidth;
1115
1134
  const g = d !== "0px" ? `border-radius:${d};` : "", u = `<img align="${c}" border="0" src="${n}" alt="${i}" title="${i}" style="display:block;border:0;height:auto;width:100%;max-width:${h}px;${g}" width="${h}" />`, f = s.href ? `<a href="${s.href}" target="${s.target}" style="text-decoration:none;">${u}</a>` : u;
1116
1135
  return z(f, { padding: o, align: c });
1117
1136
  }
1118
1137
  }
1119
- }, It = {
1138
+ }, Mt = {
1120
1139
  name: "button",
1121
1140
  label: "Button",
1122
1141
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="10" rx="2"/><path d="M12 7v10"/><path d="m8 12 4-3 4 3"/></svg>',
@@ -1203,24 +1222,24 @@ const St = {
1203
1222
  },
1204
1223
  renderer: {
1205
1224
  renderEditor(e) {
1206
- const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "buttonWidth", "auto"), g = l(e, "borderWidth", "0px"), u = l(e, "borderColor", o), f = g !== "0px" ? `border:${g} solid ${u};` : "border:none;", y = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
1225
+ const { bg: t, color: o } = st(e), n = l(e, "fontSize", "14px"), i = l(e, "fontWeight", "700"), s = l(e, "borderRadius", "4px"), r = l(e, "buttonPadding", l(e, "padding", "10px 20px")), a = l(e, "text", "Click Me"), d = l(e, "textAlign", "center"), c = l(e, "buttonWidth", "auto"), h = l(e, "borderWidth", "0px"), g = l(e, "borderColor", t), u = h !== "0px" ? `border:${h} solid ${g};` : "border:none;", f = c === "auto" ? "display:inline-block;" : `display:block;width:${c};`;
1207
1226
  return p`
1208
- <div style="padding:${t};text-align:${c};">
1209
- <a style="${y}background-color:${o};color:${n};font-size:${i};font-weight:${s};border-radius:${r};padding:${a};text-decoration:none;text-align:center;${f}cursor:pointer;font-family:arial,helvetica,sans-serif;">${d}</a>
1227
+ <div style="text-align:${d};">
1228
+ <a style="${f}background-color:${t};color:${o};font-size:${n};font-weight:${i};border-radius:${s};padding:${r};text-decoration:none;text-align:center;${u}cursor:pointer;font-family:arial,helvetica,sans-serif;">${a}</a>
1210
1229
  </div>
1211
1230
  `;
1212
1231
  },
1213
1232
  renderHtml(e) {
1214
- const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "href", "#"), g = l(e, "target", "_blank"), u = l(e, "borderWidth", "0px"), f = l(e, "borderColor", o), y = u !== "0px" ? `border:${u} solid ${f};` : "border:none;", x = _t(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: s, borderRadius: r }), m = x ? `${x}
1233
+ const t = l(e, "containerPadding", "10px"), { bg: o, color: n } = st(e), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", l(e, "padding", "10px 20px")), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "href", "#"), g = l(e, "target", "_blank"), u = l(e, "borderWidth", "0px"), f = l(e, "borderColor", o), w = u !== "0px" ? `border:${u} solid ${f};` : "border:none;", x = St(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: s, borderRadius: r }), m = x ? `${x}
1215
1234
  <!--[if !mso]><!-->` : "<!--[if !mso]><!-->", v = `<div align="${c}">
1216
1235
  ${m}
1217
- <a href="${h}" target="${g}" style="display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${r};font-size:${i};font-weight:${s};padding:${a};font-family:arial,helvetica,sans-serif;${y}mso-border-alt:none;"><span style="line-height:120%;">${d}</span></a>
1236
+ <a href="${h}" target="${g}" style="display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${r};font-size:${i};font-weight:${s};padding:${a};font-family:arial,helvetica,sans-serif;${w}mso-border-alt:none;"><span style="line-height:120%;">${d}</span></a>
1218
1237
  <!--<![endif]-->
1219
1238
  </div>`;
1220
1239
  return z(v, { padding: t, align: c });
1221
1240
  }
1222
1241
  }
1223
- }, Mt = {
1242
+ }, Pt = {
1224
1243
  name: "divider",
1225
1244
  label: "Divider",
1226
1245
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="12" x2="22" y2="12"/></svg>',
@@ -1268,51 +1287,51 @@ const St = {
1268
1287
  renderer: {
1269
1288
  renderEditor(e) {
1270
1289
  const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "borderTopColor", "#cccccc")}`;
1271
- return p`<div style="padding:${t};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1290
+ return p`<div><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1272
1291
  },
1273
1292
  renderHtml(e) {
1274
1293
  const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "borderTopColor", "#cccccc")}`, i = `<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="${o}" style="border-collapse:collapse;border-top:${n};"><tbody><tr><td style="font-size:0;line-height:0;">&nbsp;</td></tr></tbody></table>`;
1275
1294
  return z(i, { padding: t, align: "center" });
1276
1295
  }
1277
1296
  }
1278
- }, Pt = [
1297
+ }, Et = [
1279
1298
  Dt,
1280
- St,
1281
1299
  Rt,
1282
1300
  Tt,
1283
1301
  It,
1284
- Mt
1285
- ], st = [
1302
+ Mt,
1303
+ Pt
1304
+ ], rt = [
1286
1305
  {
1287
1306
  meta: { name: "html", label: "HTML", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>', position: 6 },
1288
- loader: () => import("./html-tool-D4ay2h-U.js").then((e) => e.htmlTool)
1307
+ loader: () => import("./html-tool-DMtmrF3n.js").then((e) => e.htmlTool)
1289
1308
  },
1290
1309
  {
1291
1310
  meta: { name: "social", label: "Social", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>', position: 8 },
1292
- loader: () => import("./social-tool-B8Jg2yE-.js").then((e) => e.socialTool)
1311
+ loader: () => import("./social-tool-CRY3-_sU.js").then((e) => e.socialTool)
1293
1312
  },
1294
1313
  {
1295
1314
  meta: { name: "menu", label: "Menu", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>', position: 9 },
1296
- loader: () => import("./menu-tool-KvGDbaYD.js").then((e) => e.menuTool)
1315
+ loader: () => import("./menu-tool-CJcQdpcP.js").then((e) => e.menuTool)
1297
1316
  },
1298
1317
  {
1299
1318
  meta: { name: "video", label: "Video", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>', position: 10 },
1300
- loader: () => import("./video-tool-CdGVmZxz.js").then((e) => e.videoTool)
1319
+ loader: () => import("./video-tool-g1fIoCWW.js").then((e) => e.videoTool)
1301
1320
  },
1302
1321
  {
1303
1322
  meta: { name: "timer", label: "Timer", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>', position: 11 },
1304
- loader: () => import("./timer-tool-Ck1ERDW-.js").then((e) => e.timerTool)
1323
+ loader: () => import("./timer-tool-BVE1shO1.js").then((e) => e.timerTool)
1305
1324
  },
1306
1325
  {
1307
1326
  meta: { name: "table", label: "Table", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/></svg>', position: 12 },
1308
- loader: () => import("./table-tool-BzpD08dq.js").then((e) => e.tableTool)
1327
+ loader: () => import("./table-tool-DeIQci5z.js").then((e) => e.tableTool)
1309
1328
  },
1310
1329
  {
1311
1330
  meta: { name: "form", label: "Form", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 7h10"/><path d="M7 12h10"/><path d="M7 17h6"/></svg>', position: 13 },
1312
- loader: () => import("./form-tool-CduLiZgt.js").then((e) => e.formTool)
1331
+ loader: () => import("./form-tool-DdFDrS3b.js").then((e) => e.formTool)
1313
1332
  }
1314
1333
  ];
1315
- function Et(e, t, o) {
1334
+ function zt(e, t, o) {
1316
1335
  const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", s = o.fontFamily?.value || "arial,helvetica,sans-serif", r = o.textColor || "#000000", a = o.preheaderText || "" || "&zwnj;", d = `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${a}${"&zwnj;&nbsp;".repeat(80)}</div>`;
1317
1336
  return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1318
1337
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
@@ -1363,31 +1382,31 @@ function Et(e, t, o) {
1363
1382
  </body>
1364
1383
  </html>`;
1365
1384
  }
1366
- function zt(e, t, o) {
1367
- const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", s = e.values.columnsBackgroundColor || "", r = e.values.padding || "0px", a = e.cells.reduce((m, w) => m + w, 0), d = i ? `background-color:${i};` : "", c = e.values.backgroundImage;
1385
+ function Lt(e, t, o) {
1386
+ const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", s = e.values.columnsBackgroundColor || "", r = e.values.padding || "0px", a = e.cells.reduce((m, y) => m + y, 0), d = i ? `background-color:${i};` : "", c = e.values.backgroundImage;
1368
1387
  let h = "";
1369
1388
  if (c?.url) {
1370
- const m = c.repeat === !0 || c.repeat === "repeat" ? "repeat" : "no-repeat", w = c.cover === !0 ? "cover" : c.fullWidth === !0 ? "100% auto" : "auto", v = c.center !== !1 ? "center top" : "left top";
1371
- h = `background-image:url('${c.url}');background-repeat:${m};background-position:${v};background-size:${w};`;
1389
+ const m = c.repeat === !0 || c.repeat === "repeat" ? "repeat" : "no-repeat", y = c.cover === !0 ? "cover" : c.fullWidth === !0 ? "100% auto" : "auto", v = c.center !== !1 ? "center top" : "left top";
1390
+ h = `background-image:url('${c.url}');background-repeat:${m};background-position:${v};background-size:${y};`;
1372
1391
  }
1373
- const g = e.columns.length > 1, u = e.columns.map((m, w) => {
1374
- const v = Math.round(e.cells[w] / a * n);
1375
- return { colHtml: Lt(m, v, s, t, o), colWidthPx: v };
1392
+ const g = e.columns.length > 1, u = e.columns.map((m, y) => {
1393
+ const v = Math.round(e.cells[y] / a * n);
1394
+ return { colHtml: Vt(m, v, s, t, o), colWidthPx: v };
1376
1395
  });
1377
1396
  let f;
1378
1397
  if (g) {
1379
1398
  const m = u.map(
1380
- ({ colHtml: w, colWidthPx: v }) => `<!--[if (mso)|(IE)]><td align="center" width="${v}" style="width:${v}px;padding:0px;" valign="top"><![endif]-->${w}<!--[if (mso)|(IE)]></td><![endif]-->`
1399
+ ({ colHtml: y, colWidthPx: v }) => `<!--[if (mso)|(IE)]><td align="center" width="${v}" style="width:${v}px;padding:0px;" valign="top"><![endif]-->${y}<!--[if (mso)|(IE)]></td><![endif]-->`
1381
1400
  );
1382
1401
  f = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr><![endif]-->${m.join("")}<!--[if (mso)|(IE)]></tr></table><![endif]-->`;
1383
1402
  } else
1384
1403
  f = u.map(({ colHtml: m }) => m).join("");
1385
- const y = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
1386
- return `<div class="u_row${y}${x}" style="padding:${r};${d}${h}">
1404
+ const w = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
1405
+ return `<div class="u_row${w}${x}" style="padding:${r};${d}${h}">
1387
1406
  <div style="margin:0 auto;max-width:${n}px;${g ? "font-size:0;" : ""}text-align:center;">${f}</div>
1388
1407
  </div>`;
1389
1408
  }
1390
- function Lt(e, t, o, n, i) {
1409
+ function Vt(e, t, o, n, i) {
1391
1410
  const s = e.values.backgroundColor || o || "", r = e.values.padding || "0px", a = e.values.borderRadius || "0px", d = s ? `background-color:${s};` : "", c = e.contents.map((h) => {
1392
1411
  const g = i.get(h.type);
1393
1412
  if (!g) return `<!-- unknown tool: ${h.type} -->`;
@@ -1398,8 +1417,8 @@ function Lt(e, t, o, n, i) {
1398
1417
  bodyValues: n
1399
1418
  };
1400
1419
  let f = g(h.values, u);
1401
- const y = !!h.values.hideDesktop, x = !!h.values.hideMobile;
1402
- return (y || x) && (f = `<div class="${[y && "u_hide_desktop", x && "u_hide_mobile"].filter(Boolean).join(" ")}">${f}</div>`), f;
1420
+ const w = !!h.values.hideDesktop, x = !!h.values.hideMobile;
1421
+ return (w || x) && (f = `<div class="${[w && "u_hide_desktop", x && "u_hide_mobile"].filter(Boolean).join(" ")}">${f}</div>`), f;
1403
1422
  }).join(`
1404
1423
  `);
1405
1424
  return `<div class="u_column" style="display:inline-block;vertical-align:top;width:${t}px;max-width:${t}px;font-size:14px;text-align:left;">
@@ -1410,7 +1429,7 @@ function Lt(e, t, o, n, i) {
1410
1429
  </div>
1411
1430
  </div>`;
1412
1431
  }
1413
- function Vt(e) {
1432
+ function At(e) {
1414
1433
  return `
1415
1434
  @media only screen and (min-width: ${e + 20}px) {
1416
1435
  .u_row .u_column { display: inline-block !important; }
@@ -1459,9 +1478,8 @@ function Vt(e) {
1459
1478
  .u_hide_mobile { display: block !important; }
1460
1479
  }`;
1461
1480
  }
1462
- const At = [
1481
+ const Bt = [
1463
1482
  "box-sizing",
1464
- "float",
1465
1483
  "overflow-wrap",
1466
1484
  "word-break",
1467
1485
  "word-wrap",
@@ -1470,25 +1488,24 @@ const At = [
1470
1488
  "transition",
1471
1489
  "animation",
1472
1490
  "transform",
1473
- "position",
1474
1491
  "z-index",
1475
1492
  "display:\\s*flex",
1476
1493
  "display:\\s*grid",
1477
1494
  "gap"
1478
- ], Bt = new RegExp(
1479
- `(?:;\\s*|^\\s*)(${At.join("|")})\\s*:[^;]*;?`,
1495
+ ], Ot = new RegExp(
1496
+ `(?:;\\s*|^\\s*)(${Bt.join("|")})\\s*:[^;]*;?`,
1480
1497
  "gi"
1481
- ), Ot = /var\(--[^)]*\)/gi;
1482
- function Ht(e) {
1498
+ ), Ht = /var\(--[^)]*\)/gi;
1499
+ function jt(e) {
1483
1500
  return e.replace(/style="([^"]*)"/gi, (t, o) => {
1484
1501
  let n = o;
1485
- return n = n.replace(Bt, ""), n = n.replace(Ot, "inherit"), n = n.replace(/;\s*;/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim(), n ? `style="${n}"` : "";
1502
+ return n = n.replace(Ot, ""), n = n.replace(Ht, "inherit"), n = n.replace(/;\s*;/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim(), n ? `style="${n}"` : "";
1486
1503
  });
1487
1504
  }
1488
- function jt(e, t, o) {
1489
- const n = e.body.values, i = parseInt(n.contentWidth || "600"), s = e.body.rows.map((u) => zt(u, n, t)).join(`
1490
- `), r = Vt(i), a = Ht(s);
1491
- let d = Et(a, r, n);
1505
+ function Wt(e, t, o) {
1506
+ const n = e.body.values, i = parseInt(n.contentWidth || "600"), s = e.body.rows.map((u) => Lt(u, n, t)).join(`
1507
+ `), r = At(i), a = jt(s);
1508
+ let d = zt(a, r, n);
1492
1509
  if (o?.mergeTags)
1493
1510
  for (const [u, f] of Object.entries(o.mergeTags))
1494
1511
  d = d.replaceAll(`{{${u}}}`, f);
@@ -1529,10 +1546,10 @@ class T {
1529
1546
  }));
1530
1547
  }
1531
1548
  }
1532
- var Wt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, at = (e, t, o, n) => {
1533
- for (var i = n > 1 ? void 0 : n ? Ut(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1549
+ var Ut = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, dt = (e, t, o, n) => {
1550
+ for (var i = n > 1 ? void 0 : n ? Ft(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1534
1551
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1535
- return n && i && Wt(t, o, i), i;
1552
+ return n && i && Ut(t, o, i), i;
1536
1553
  };
1537
1554
  let V = class extends $ {
1538
1555
  constructor() {
@@ -1659,40 +1676,37 @@ V.styles = k`
1659
1676
  stroke-linejoin: round;
1660
1677
  }
1661
1678
  `;
1662
- at([
1679
+ dt([
1663
1680
  b({ type: Boolean })
1664
1681
  ], V.prototype, "visible", 2);
1665
- V = at([
1682
+ V = dt([
1666
1683
  C("me-inline-toolbar")
1667
1684
  ], V);
1668
- var Ft = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, O = (e, t, o, n) => {
1669
- for (var i = n > 1 ? void 0 : n ? Nt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1685
+ var Nt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, O = (e, t, o, n) => {
1686
+ for (var i = n > 1 ? void 0 : n ? qt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1670
1687
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1671
- return n && i && Ft(t, o, i), i;
1688
+ return n && i && Nt(t, o, i), i;
1672
1689
  };
1673
- const rt = /* @__PURE__ */ new Set(["text", "heading", "paragraph"]);
1674
- function lt(e) {
1690
+ const lt = /* @__PURE__ */ new Set(["text", "heading", "paragraph"]);
1691
+ function at(e) {
1675
1692
  return e === "html" ? "html" : "text";
1676
1693
  }
1677
- let D = class extends $ {
1694
+ let S = class extends $ {
1678
1695
  constructor() {
1679
- super(...arguments), this.storeCtrl = new T(this, ["design", "selection", "hover", "viewMode"]), this.editing = !1, this.toolbar = null, this.editableEl = null, this.saveDebounceTimer = null, this._onDragStart = (e) => {
1680
- if (this.editing) {
1681
- e.preventDefault();
1682
- return;
1683
- }
1684
- e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", L.startContentDrag(this.content.id);
1685
- }, this._onDragEnd = () => {
1686
- this.style.opacity = "1", L.reset();
1687
- }, this.handleInlineInput = () => {
1688
- this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer), this.saveDebounceTimer = setTimeout(() => this.saveInlineContent(), 500), this.showToolbar();
1696
+ super(...arguments), this.storeCtrl = new T(this, ["design", "selection", "hover", "viewMode"]), this.editing = !1, this.toolbar = null, this.editableEl = null, this.saveDebounceTimer = null, this.handleInlineInput = () => {
1697
+ this.showToolbar();
1689
1698
  }, this.handleInlineBlur = (e) => {
1690
1699
  const t = e.relatedTarget;
1691
1700
  t && (t.closest("me-inline-toolbar") || this.toolbar?.contains(t)) || setTimeout(() => {
1692
- !this.shadowRoot?.activeElement && !this.toolbar?.matches(":hover") && this.stopEditing();
1701
+ document.activeElement !== this.editableEl && !this.toolbar?.matches(":hover") && this.stopEditing();
1693
1702
  }, 150);
1703
+ }, this.handleOverlayBlur = (e) => {
1704
+ const t = e.relatedTarget;
1705
+ t && (t.closest("me-inline-toolbar") || this.toolbar?.contains(t)) || setTimeout(() => {
1706
+ document.activeElement !== this.editableEl && !this.toolbar?.matches(":hover") && this.stopEditing();
1707
+ }, 200);
1694
1708
  }, this.handleInlineKeydown = (e) => {
1695
- e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.stopEditing()), (e.key === "Delete" || e.key === "Backspace") && e.stopPropagation();
1709
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.stopEditing());
1696
1710
  };
1697
1711
  }
1698
1712
  set store(e) {
@@ -1706,7 +1720,7 @@ let D = class extends $ {
1706
1720
  e.stopPropagation(), this.editing || this.store.select(this.content.id);
1707
1721
  }
1708
1722
  handleDblClick(e) {
1709
- e.stopPropagation(), rt.has(this.content.type) && this.startEditing();
1723
+ e.stopPropagation(), lt.has(this.content.type) && this.startEditing();
1710
1724
  }
1711
1725
  handleMouseEnter() {
1712
1726
  this.store.hover(this.content.id);
@@ -1720,23 +1734,46 @@ let D = class extends $ {
1720
1734
  handleDuplicate(e) {
1721
1735
  e.stopPropagation(), this.store.duplicateContent(this.content.id);
1722
1736
  }
1737
+ /** Called from the drag handle only (not the whole block) */
1738
+ handleDragStart(e) {
1739
+ e.stopPropagation(), e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", L.startContentDrag(this.content.id);
1740
+ }
1741
+ handleDragEnd() {
1742
+ this.style.opacity = "1", L.reset();
1743
+ }
1723
1744
  // ── Inline editing ───────────────────────────────────────
1724
1745
  startEditing() {
1725
- this.editing = !0, this.classList.add("editing"), this.setAttribute("draggable", "false"), this.updateComplete.then(() => {
1726
- const e = this.shadowRoot?.querySelector(".inline-editable");
1727
- if (e) {
1728
- this.editableEl = e, e.focus();
1729
- const t = window.getSelection(), o = document.createRange();
1730
- o.selectNodeContents(e), o.collapse(!1), t?.removeAllRanges(), t?.addRange(o), this.showToolbar();
1731
- }
1732
- });
1746
+ this.editing = !0, this.classList.add("editing"), this.storeCtrl.hostDisconnected();
1747
+ const e = this.getBoundingClientRect(), t = this.getInlineStyles(this.content.values), o = at(this.content.type), n = this.content.values[o] || "", i = document.createElement("div");
1748
+ i.contentEditable = "true", i.innerHTML = n, Object.assign(i.style, {
1749
+ position: "fixed",
1750
+ left: e.left + "px",
1751
+ top: e.top + "px",
1752
+ width: e.width + "px",
1753
+ minHeight: e.height + "px",
1754
+ zIndex: "9999",
1755
+ background: "white",
1756
+ boxShadow: "0 0 0 2px #8b5cf6, 0 4px 16px rgba(0,0,0,0.15)",
1757
+ borderRadius: "2px",
1758
+ outline: "none",
1759
+ boxSizing: "border-box"
1760
+ }), t.split(";").forEach((a) => {
1761
+ const [d, c] = a.split(":").map((h) => h?.trim());
1762
+ if (d && c)
1763
+ try {
1764
+ i.style.setProperty(d, c);
1765
+ } catch {
1766
+ }
1767
+ }), i.addEventListener("keydown", this.handleInlineKeydown), i.addEventListener("blur", this.handleOverlayBlur), document.body.appendChild(i), this.editableEl = i, i.focus();
1768
+ const s = window.getSelection(), r = document.createRange();
1769
+ r.selectNodeContents(i), r.collapse(!1), s?.removeAllRanges(), s?.addRange(r), this.showToolbar();
1733
1770
  }
1734
1771
  stopEditing() {
1735
- this.editing && (this.saveInlineContent(), this.editing = !1, this.classList.remove("editing"), this.setAttribute("draggable", "true"), this.editableEl = null, this.toolbar?.hide());
1772
+ this.editing && (this.saveInlineContent(), this.editableEl && (this.editableEl.removeEventListener("keydown", this.handleInlineKeydown), this.editableEl.removeEventListener("blur", this.handleOverlayBlur), this.editableEl.remove()), this.editing = !1, this.classList.remove("editing"), this.editableEl = null, this.storeCtrl.hostConnected(), this.requestUpdate(), this.toolbar?.hide());
1736
1773
  }
1737
1774
  saveInlineContent() {
1738
1775
  if (!this.editableEl) return;
1739
- const e = this.editableEl.innerHTML, t = lt(this.content.type), o = this.content.values[t];
1776
+ const e = this.editableEl.innerHTML, t = at(this.content.type), o = this.content.values[t];
1740
1777
  e !== o && this.store.updateContentValues(this.content.id, { [t]: e });
1741
1778
  }
1742
1779
  showToolbar() {
@@ -1744,54 +1781,48 @@ let D = class extends $ {
1744
1781
  }
1745
1782
  // ── Lifecycle ────────────────────────────────────────────
1746
1783
  connectedCallback() {
1747
- super.connectedCallback(), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragend", this._onDragEnd);
1784
+ super.connectedCallback();
1748
1785
  }
1749
1786
  disconnectedCallback() {
1750
- super.disconnectedCallback(), this.removeEventListener("dragstart", this._onDragStart), this.removeEventListener("dragend", this._onDragEnd), this.toolbar?.remove(), this.toolbar = null, this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer);
1787
+ super.disconnectedCallback(), this.toolbar?.remove(), this.toolbar = null, this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer);
1751
1788
  }
1752
1789
  // ── Render ───────────────────────────────────────────────
1753
1790
  render() {
1754
1791
  if (!this.store) return p``;
1755
1792
  const e = this.store.selectedId === this.content.id, t = this.store.hoveredId === this.content.id, o = this.store.viewMode, n = !!this.content.values.hideDesktop, i = !!this.content.values.hideMobile, s = o === "desktop" && n || o === "mobile" && i;
1756
- this.classList.toggle("selected", e && !this.editing), this.classList.toggle("hovered", t && !this.editing), this.classList.toggle("hidden-in-view", s), this.editing || this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id, this.editing && !e && this.stopEditing();
1793
+ this.classList.toggle("selected", e && !this.editing), this.classList.toggle("hovered", t && !this.editing), this.classList.toggle("hidden-in-view", s), this.removeAttribute("draggable"), this.dataset.contentId = this.content.id, this.editing && !e && this.stopEditing();
1757
1794
  const r = this.toolRegistry.get(this.content.type);
1758
1795
  if (!r && this.toolRegistry.has(this.content.type))
1759
1796
  return this.toolRegistry.ensureLoaded(this.content.type).then(() => this.requestUpdate()), p`<div style="padding:16px;text-align:center;color:#9ca3af;font-size:13px;">Loading ${this.content.type}...</div>`;
1760
- const a = n ? "Hidden on desktop" : i ? "Hidden on mobile" : "", d = rt.has(this.content.type);
1761
- if (this.editing && d && r) {
1762
- const h = this.content.values, g = lt(this.content.type), u = h[g] || "", f = this.getInlineStyles(h);
1763
- return p`
1764
- <div class="content-wrapper">
1765
- <div
1766
- class="inline-editable"
1767
- contenteditable="true"
1768
- style=${f}
1769
- .innerHTML=${u}
1770
- @input=${this.handleInlineInput}
1771
- @blur=${this.handleInlineBlur}
1772
- @keydown=${this.handleInlineKeydown}
1773
- ></div>
1774
- </div>
1775
- `;
1776
- }
1777
- const c = r?.renderer.renderEditor(this.content.values, {
1797
+ const a = n ? "Hidden on desktop" : i ? "Hidden on mobile" : "", d = lt.has(this.content.type), c = p`
1798
+ <button class="drag-handle" draggable="true" title="Drag to move"
1799
+ @dragstart=${(u) => this.handleDragStart(u)}
1800
+ @dragend=${() => this.handleDragEnd()}
1801
+ @mousedown=${(u) => u.stopPropagation()}>
1802
+ <svg viewBox="0 0 16 16"><circle cx="5" cy="3" r="1.5"/><circle cx="11" cy="3" r="1.5"/><circle cx="5" cy="8" r="1.5"/><circle cx="11" cy="8" r="1.5"/><circle cx="5" cy="13" r="1.5"/><circle cx="11" cy="13" r="1.5"/></svg>
1803
+ </button>
1804
+ `, h = r?.renderer.renderEditor(this.content.values, {
1778
1805
  isSelected: e,
1779
1806
  isHovered: t,
1780
1807
  columnWidth: 600,
1781
1808
  displayMode: "email"
1782
1809
  });
1810
+ if (this.editing && d)
1811
+ return p`${c}<div class="content-wrapper" style="visibility:hidden;">${h}</div>`;
1812
+ const g = this.content.values.containerPadding || "0px";
1783
1813
  return p`
1784
1814
  ${s ? p`<div class="hidden-badge">${a}</div>` : ""}
1815
+ ${c}
1785
1816
  <div class="action-bar">
1786
1817
  <button class="action-btn" @click=${this.handleDuplicate} title="Duplicate">&#9851;</button>
1787
1818
  <button class="action-btn" @click=${this.handleDelete} title="Delete">&#10005;</button>
1788
1819
  </div>
1789
- <div class="content-wrapper"
1820
+ <div class="content-wrapper" style="padding:${g};"
1790
1821
  @click=${this.handleClick}
1791
1822
  @dblclick=${this.handleDblClick}
1792
1823
  @mouseenter=${this.handleMouseEnter}
1793
1824
  @mouseleave=${this.handleMouseLeave}>
1794
- ${c ?? p`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
1825
+ ${h ?? p`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
1795
1826
  </div>
1796
1827
  `;
1797
1828
  }
@@ -1820,14 +1851,14 @@ let D = class extends $ {
1820
1851
  return typeof h == "string" ? t.push(`font-family:${h}`) : h && typeof h == "object" && t.push(`font-family:${h.value || "inherit"}`), t.push("word-break:break-word", "outline:none", "min-height:1em"), t.join(";");
1821
1852
  }
1822
1853
  };
1823
- D.styles = k`
1854
+ S.styles = k`
1824
1855
  :host {
1825
- display: block; position: relative; cursor: pointer;
1856
+ display: block; position: relative;
1826
1857
  transition: outline 0.15s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
1827
1858
  }
1828
1859
  :host(.selected) { outline: 2px solid #3b82f6; outline-offset: -1px; }
1829
1860
  :host(.hovered:not(.selected)) { outline: 2px dashed #93c5fd; outline-offset: -1px; }
1830
- :host(.editing) { outline: 2px solid #8b5cf6; outline-offset: -1px; cursor: text; }
1861
+ :host(.editing) { outline: 2px solid #8b5cf6; outline-offset: -1px; }
1831
1862
  :host(.just-dropped) {
1832
1863
  animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
1833
1864
  }
@@ -1842,6 +1873,39 @@ D.styles = k`
1842
1873
  0% { opacity: 0; transform: scale(0.92) translateY(-8px); }
1843
1874
  100% { opacity: 1; transform: scale(1) translateY(0); }
1844
1875
  }
1876
+ /* Drag handle — straddles the right border, vertically centered */
1877
+ .drag-handle {
1878
+ display: none;
1879
+ position: absolute;
1880
+ top: 50%;
1881
+ right: -12px;
1882
+ transform: translateY(-50%);
1883
+ width: 24px;
1884
+ height: 24px;
1885
+ background: #3b82f6;
1886
+ color: white;
1887
+ border: 2px solid white;
1888
+ border-radius: 50%;
1889
+ cursor: grab;
1890
+ z-index: 20;
1891
+ align-items: center;
1892
+ justify-content: center;
1893
+ padding: 0;
1894
+ box-shadow: 0 1px 4px rgba(0,0,0,0.2);
1895
+ transition: background 0.15s ease, transform 0.15s ease;
1896
+ }
1897
+ .drag-handle:hover {
1898
+ background: #2563eb;
1899
+ transform: translateY(-50%) scale(1.15);
1900
+ }
1901
+ .drag-handle:active { cursor: grabbing; }
1902
+ .drag-handle svg {
1903
+ width: 12px; height: 12px; fill: currentColor; stroke: none;
1904
+ }
1905
+ :host(.selected) .drag-handle,
1906
+ :host(.hovered) .drag-handle { display: flex; }
1907
+ :host(.editing) .drag-handle { display: none; }
1908
+ /* Action bar */
1845
1909
  .action-bar {
1846
1910
  display: none; position: absolute; top: -28px; right: 4px;
1847
1911
  background: #3b82f6; border-radius: 4px; padding: 2px; gap: 2px; z-index: 10;
@@ -1852,37 +1916,39 @@ D.styles = k`
1852
1916
  padding: 2px 6px; font-size: 12px; line-height: 1; border-radius: 2px;
1853
1917
  }
1854
1918
  .action-btn:hover { background: rgba(255,255,255,0.2); }
1855
- .content-wrapper { position: relative; }
1919
+ .content-wrapper { position: relative; cursor: default; box-sizing: border-box; }
1920
+ /* Reset paragraph margins in user content to match email rendering.
1921
+ Override inline margin from external editors (e.g. margin: 1.25em 0px). */
1922
+ .content-wrapper p { margin: 0 !important; }
1923
+ /* Reset paragraph margins to match email rendering.
1924
+ Spacing comes from line-height, <br>, and &nbsp; in the HTML content. */
1925
+ .content-wrapper p { margin: 0; }
1856
1926
  .inline-editable {
1857
- outline: none;
1858
- cursor: text;
1859
- min-height: 1em;
1860
- }
1861
- .inline-editable:focus {
1862
- outline: none;
1927
+ outline: none; cursor: text; min-height: 1em;
1863
1928
  }
1929
+ .inline-editable:focus { outline: none; }
1864
1930
  `;
1865
1931
  O([
1866
1932
  b({ attribute: !1 })
1867
- ], D.prototype, "content", 2);
1933
+ ], S.prototype, "content", 2);
1868
1934
  O([
1869
1935
  b({ attribute: !1 })
1870
- ], D.prototype, "store", 1);
1936
+ ], S.prototype, "store", 1);
1871
1937
  O([
1872
1938
  b({ attribute: !1 })
1873
- ], D.prototype, "toolRegistry", 2);
1939
+ ], S.prototype, "toolRegistry", 2);
1874
1940
  O([
1875
- pt()
1876
- ], D.prototype, "editing", 2);
1877
- D = O([
1941
+ ht()
1942
+ ], S.prototype, "editing", 2);
1943
+ S = O([
1878
1944
  C("me-content-renderer")
1879
- ], D);
1880
- var qt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, H = (e, t, o, n) => {
1881
- for (var i = n > 1 ? void 0 : n ? Gt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1945
+ ], S);
1946
+ var Gt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, H = (e, t, o, n) => {
1947
+ for (var i = n > 1 ? void 0 : n ? Kt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1882
1948
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1883
- return n && i && qt(t, o, i), i;
1949
+ return n && i && Gt(t, o, i), i;
1884
1950
  };
1885
- let S = class extends $ {
1951
+ let D = class extends $ {
1886
1952
  constructor() {
1887
1953
  super(...arguments), this.storeCtrl = new T(this, ["design"]), this.widthPercent = 100;
1888
1954
  }
@@ -1911,7 +1977,7 @@ let S = class extends $ {
1911
1977
  `;
1912
1978
  }
1913
1979
  };
1914
- S.styles = k`
1980
+ D.styles = k`
1915
1981
  :host {
1916
1982
  display: block;
1917
1983
  min-height: 40px;
@@ -1943,23 +2009,23 @@ S.styles = k`
1943
2009
  `;
1944
2010
  H([
1945
2011
  b({ attribute: !1 })
1946
- ], S.prototype, "column", 2);
2012
+ ], D.prototype, "column", 2);
1947
2013
  H([
1948
2014
  b({ attribute: !1 })
1949
- ], S.prototype, "store", 1);
2015
+ ], D.prototype, "store", 1);
1950
2016
  H([
1951
2017
  b({ attribute: !1 })
1952
- ], S.prototype, "toolRegistry", 2);
2018
+ ], D.prototype, "toolRegistry", 2);
1953
2019
  H([
1954
2020
  b({ type: Number })
1955
- ], S.prototype, "widthPercent", 2);
1956
- S = H([
2021
+ ], D.prototype, "widthPercent", 2);
2022
+ D = H([
1957
2023
  C("me-column-renderer")
1958
- ], S);
1959
- var Kt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, F = (e, t, o, n) => {
1960
- for (var i = n > 1 ? void 0 : n ? Yt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2024
+ ], D);
2025
+ var Yt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, F = (e, t, o, n) => {
2026
+ for (var i = n > 1 ? void 0 : n ? Jt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1961
2027
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1962
- return n && i && Kt(t, o, i), i;
2028
+ return n && i && Yt(t, o, i), i;
1963
2029
  };
1964
2030
  let R = class extends $ {
1965
2031
  constructor() {
@@ -1992,12 +2058,12 @@ let R = class extends $ {
1992
2058
  const { row: e, store: t, toolRegistry: o } = this, n = e.values.backgroundColor || "transparent", i = e.values.columnsBackgroundColor || "transparent", s = e.values.padding || "0px", r = e.cells.reduce((x, m) => x + m, 0), a = e.values.backgroundImage, d = typeof a == "object" && a?.url ? a.url : "";
1993
2059
  let c = "";
1994
2060
  if (d) {
1995
- const x = a.repeat === !0 || a.repeat === "repeat" ? "repeat" : "no-repeat", m = a.cover === !0 ? "cover" : a.fullWidth === !0 ? "100% auto" : "auto", w = a.center !== !1 ? "center" : "top left";
1996
- c = `background-image:url('${d}');background-size:${m};background-position:${w};background-repeat:${x};`;
2061
+ const x = a.repeat === !0 || a.repeat === "repeat" ? "repeat" : "no-repeat", m = a.cover === !0 ? "cover" : a.fullWidth === !0 ? "100% auto" : "auto", y = a.center !== !1 ? "center" : "top left";
2062
+ c = `background-image:url('${d}');background-size:${m};background-position:${y};background-repeat:${x};`;
1997
2063
  }
1998
- const h = t.viewMode, g = !!e.values.hideDesktop, u = !!e.values.hideMobile, f = h === "desktop" && g || h === "mobile" && u, y = g ? "Hidden on desktop" : u ? "Hidden on mobile" : "";
2064
+ const h = t.viewMode, g = !!e.values.hideDesktop, u = !!e.values.hideMobile, f = h === "desktop" && g || h === "mobile" && u, w = g ? "Hidden on desktop" : u ? "Hidden on mobile" : "";
1999
2065
  return this.classList.toggle("hidden-in-view", f), this.setAttribute("draggable", "true"), this.dataset.rowId = e.id, p`
2000
- ${f ? p`<div class="row-hidden-badge">${y}</div>` : ""}
2066
+ ${f ? p`<div class="row-hidden-badge">${w}</div>` : ""}
2001
2067
  <div class="row-actions">
2002
2068
  <button class="row-action-btn" @click=${this.handleMoveUp} title="Move Up">
2003
2069
  <svg viewBox="0 0 24 24"><path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>
@@ -2017,13 +2083,13 @@ let R = class extends $ {
2017
2083
  style="background-color:${n};padding:${s};${c}"
2018
2084
  >
2019
2085
  ${e.columns.map((x, m) => {
2020
- const w = e.cells[m] / r * 100;
2086
+ const y = e.cells[m] / r * 100;
2021
2087
  return p`
2022
2088
  <me-column-renderer
2023
2089
  .column=${x}
2024
2090
  .store=${t}
2025
2091
  .toolRegistry=${o}
2026
- .widthPercent=${w}
2092
+ .widthPercent=${y}
2027
2093
  style="background-color:${i};"
2028
2094
  ></me-column-renderer>
2029
2095
  `;
@@ -2108,10 +2174,10 @@ F([
2108
2174
  R = F([
2109
2175
  C("me-row-renderer")
2110
2176
  ], R);
2111
- var Jt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, J = (e, t, o, n) => {
2112
- for (var i = n > 1 ? void 0 : n ? Xt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2177
+ var Xt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, J = (e, t, o, n) => {
2178
+ for (var i = n > 1 ? void 0 : n ? Qt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2113
2179
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2114
- return n && i && Jt(t, o, i), i;
2180
+ return n && i && Xt(t, o, i), i;
2115
2181
  };
2116
2182
  let M = class extends $ {
2117
2183
  constructor() {
@@ -2229,10 +2295,10 @@ J([
2229
2295
  M = J([
2230
2296
  C("me-editor-canvas")
2231
2297
  ], M);
2232
- var Qt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, dt = (e, t, o, n) => {
2233
- for (var i = n > 1 ? void 0 : n ? Zt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2298
+ var Zt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, ct = (e, t, o, n) => {
2299
+ for (var i = n > 1 ? void 0 : n ? te(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2234
2300
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2235
- return n && i && Qt(t, o, i), i;
2301
+ return n && i && Zt(t, o, i), i;
2236
2302
  };
2237
2303
  const G = [
2238
2304
  // System / email-safe fonts
@@ -2376,16 +2442,16 @@ A.styles = k`
2376
2442
  }
2377
2443
  .align-btn.active { border-color: #3b82f6; background: #eff6ff; color: #3b82f6; }
2378
2444
  `;
2379
- dt([
2445
+ ct([
2380
2446
  b({ attribute: !1 })
2381
2447
  ], A.prototype, "store", 1);
2382
- A = dt([
2448
+ A = ct([
2383
2449
  C("me-body-settings")
2384
2450
  ], A);
2385
- var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, X = (e, t, o, n) => {
2386
- for (var i = n > 1 ? void 0 : n ? ee(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2451
+ var ee = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, X = (e, t, o, n) => {
2452
+ for (var i = n > 1 ? void 0 : n ? oe(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2387
2453
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2388
- return n && i && te(t, o, i), i;
2454
+ return n && i && ee(t, o, i), i;
2389
2455
  };
2390
2456
  let P = class extends $ {
2391
2457
  constructor() {
@@ -2622,7 +2688,7 @@ X([
2622
2688
  P = X([
2623
2689
  C("me-editor-sidebar")
2624
2690
  ], P);
2625
- function oe(e, t, o) {
2691
+ function ne(e, t, o) {
2626
2692
  const n = e && /^#[0-9a-fA-F]{3,8}$/.test(e) ? e : "#000000";
2627
2693
  return p`
2628
2694
  <div class="prop-row">
@@ -2636,7 +2702,7 @@ function oe(e, t, o) {
2636
2702
  </div>
2637
2703
  `;
2638
2704
  }
2639
- function ne(e, t, o, n) {
2705
+ function ie(e, t, o, n) {
2640
2706
  const i = n?.options || [];
2641
2707
  return p`
2642
2708
  <div class="prop-row">
@@ -2647,7 +2713,7 @@ function ne(e, t, o, n) {
2647
2713
  </div>
2648
2714
  `;
2649
2715
  }
2650
- function ie(e, t, o) {
2716
+ function se(e, t, o) {
2651
2717
  return p`
2652
2718
  <div class="prop-row">
2653
2719
  <label class="prop-label">${o}</label>
@@ -2662,15 +2728,15 @@ function ie(e, t, o) {
2662
2728
  </div>
2663
2729
  `;
2664
2730
  }
2665
- function se(e) {
2731
+ function re(e) {
2666
2732
  const t = (e || "0px").split(/\s+/).map((r) => parseInt(r) || 0), o = t[0], n = t[1] ?? o, i = t[2] ?? o, s = t[3] ?? n;
2667
2733
  return [o, n, i, s];
2668
2734
  }
2669
- function re(e, t, o, n) {
2735
+ function le(e, t, o, n) {
2670
2736
  return e === t && t === o && o === n ? `${e}px` : e === o && t === n ? `${e}px ${t}px` : `${e}px ${t}px ${o}px ${n}px`;
2671
2737
  }
2672
- function le(e, t, o) {
2673
- const [n, i, s, r] = se(e), a = (c, h, g, u) => t(re(c, h, g, u));
2738
+ function ae(e, t, o) {
2739
+ const [n, i, s, r] = re(e), a = (c, h, g, u) => t(le(c, h, g, u));
2674
2740
  return p`
2675
2741
  <div class="prop-row">
2676
2742
  <label class="prop-label">${o}</label>
@@ -2692,7 +2758,7 @@ function le(e, t, o) {
2692
2758
  </div>
2693
2759
  `;
2694
2760
  }
2695
- function ae(e, t, o) {
2761
+ function de(e, t, o) {
2696
2762
  return p`
2697
2763
  <div class="prop-row">
2698
2764
  <div class="prop-toggle">
@@ -2703,7 +2769,7 @@ function ae(e, t, o) {
2703
2769
  </div>
2704
2770
  `;
2705
2771
  }
2706
- function de(e, t, o) {
2772
+ function ce(e, t, o) {
2707
2773
  return p`
2708
2774
  <div class="prop-row">
2709
2775
  <label class="prop-label">${o}</label>
@@ -2712,7 +2778,7 @@ function de(e, t, o) {
2712
2778
  </div>
2713
2779
  `;
2714
2780
  }
2715
- function ce(e, t, o) {
2781
+ function pe(e, t, o) {
2716
2782
  return p`
2717
2783
  <div class="prop-row">
2718
2784
  <label class="prop-label">${o}</label>
@@ -2724,10 +2790,33 @@ function ce(e, t, o) {
2724
2790
  </div>
2725
2791
  `;
2726
2792
  }
2727
- var pe = Object.defineProperty, he = Object.getOwnPropertyDescriptor, Q = (e, t, o, n) => {
2728
- for (var i = n > 1 ? void 0 : n ? he(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2793
+ function he(e, t, o, n) {
2794
+ const i = n?.unit || "px", s = n?.min ?? 0, r = n?.max ?? 100, a = n?.step ?? 0.1, d = parseFloat(e) || 0, c = (h) => {
2795
+ const g = parseFloat(h.target.value) || 0;
2796
+ t(`${g}${i}`);
2797
+ };
2798
+ return p`
2799
+ <div class="prop-row">
2800
+ <label class="prop-label">${o}</label>
2801
+ <div style="display:flex;align-items:center;gap:4px;">
2802
+ <input
2803
+ type="number"
2804
+ .value=${String(d)}
2805
+ min=${s}
2806
+ max=${r}
2807
+ step=${a}
2808
+ @input=${c}
2809
+ style="flex:1;padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;color:#111827;"
2810
+ />
2811
+ <span style="font-size:12px;color:#9ca3af;min-width:20px;">${i}</span>
2812
+ </div>
2813
+ </div>
2814
+ `;
2815
+ }
2816
+ var ue = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, Q = (e, t, o, n) => {
2817
+ for (var i = n > 1 ? void 0 : n ? ge(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2729
2818
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2730
- return n && i && pe(t, o, i), i;
2819
+ return n && i && ue(t, o, i), i;
2731
2820
  };
2732
2821
  let E = class extends $ {
2733
2822
  constructor() {
@@ -2778,20 +2867,22 @@ let E = class extends $ {
2778
2867
  const n = e.values[t] ?? o.defaultValue, i = this.onChange(e.id, t);
2779
2868
  switch (o.widget) {
2780
2869
  case "color_picker":
2781
- return oe(n, i, o.label);
2870
+ return ne(n, i, o.label);
2782
2871
  case "toggle":
2783
- return ae(n, i, o.label);
2872
+ return de(n, i, o.label);
2784
2873
  case "rich_text":
2785
- return ce(n, i, o.label);
2874
+ return pe(n, i, o.label);
2786
2875
  case "dropdown":
2787
- return ne(n, i, o.label, o.widgetParams);
2876
+ return ie(n, i, o.label, o.widgetParams);
2788
2877
  case "alignment":
2789
- return ie(n, i, o.label);
2878
+ return se(n, i, o.label);
2790
2879
  case "padding":
2791
- return le(n, i, o.label);
2880
+ return ae(n, i, o.label);
2881
+ case "number_unit":
2882
+ return he(n, i, o.label, o.widgetParams);
2792
2883
  case "text":
2793
2884
  default:
2794
- return de(n, i, o.label);
2885
+ return ce(n, i, o.label);
2795
2886
  }
2796
2887
  }
2797
2888
  };
@@ -2838,17 +2929,17 @@ Q([
2838
2929
  E = Q([
2839
2930
  C("me-property-panel")
2840
2931
  ], E);
2841
- var ue = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, ct = (e, t, o, n) => {
2842
- for (var i = n > 1 ? void 0 : n ? ge(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2932
+ var fe = Object.defineProperty, be = Object.getOwnPropertyDescriptor, pt = (e, t, o, n) => {
2933
+ for (var i = n > 1 ? void 0 : n ? be(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2843
2934
  (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2844
- return n && i && ue(t, o, i), i;
2935
+ return n && i && fe(t, o, i), i;
2845
2936
  };
2846
2937
  let B = class extends $ {
2847
2938
  constructor() {
2848
- super(...arguments), this.options = {}, this.store = new vt(), this.toolRegistry = new $t(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
2939
+ super(...arguments), this.options = {}, this.store = new $t(), this.toolRegistry = new kt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
2849
2940
  const t = e.metaKey || e.ctrlKey, n = e.composedPath().some((i) => {
2850
- const s = i?.tagName;
2851
- return s === "INPUT" || s === "TEXTAREA" || s === "SELECT";
2941
+ const s = i, r = s?.tagName;
2942
+ return !!(r === "INPUT" || r === "TEXTAREA" || r === "SELECT" || s?.isContentEditable);
2852
2943
  });
2853
2944
  n && !t || (t && e.key === "z" && !e.shiftKey ? (e.preventDefault(), this.store.undo()) : t && (e.key === "y" || e.key === "z" && e.shiftKey) ? (e.preventDefault(), this.store.redo()) : (e.key === "Delete" || e.key === "Backspace") && this.store.selectedId && !n ? (e.preventDefault(), this.store.removeContent(this.store.selectedId)) : e.key === "Escape" && this.store.select(null));
2854
2945
  };
@@ -2857,7 +2948,7 @@ let B = class extends $ {
2857
2948
  super.connectedCallback(), this.registerBuiltInTools(), this.applyOptions(), this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this._handleKeydown);
2858
2949
  }
2859
2950
  firstUpdated() {
2860
- this.dragManager = new kt(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
2951
+ this.dragManager = new Ct(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
2861
2952
  this.dispatchEvent(new CustomEvent("design:loaded", { detail: e, bubbles: !0, composed: !0 }));
2862
2953
  }), this.store.events.on("design:updated", (e) => {
2863
2954
  this.dispatchEvent(new CustomEvent("design:updated", { detail: e, bubbles: !0, composed: !0 }));
@@ -2888,7 +2979,7 @@ let B = class extends $ {
2888
2979
  const n = /* @__PURE__ */ new Map();
2889
2980
  for (const i of this.toolRegistry.getAll())
2890
2981
  n.set(i.name, (s, r) => i.renderer.renderHtml(s, r));
2891
- t(jt(e, n, o));
2982
+ t(Wt(e, n, o));
2892
2983
  }
2893
2984
  async exportHtmlAsync(e) {
2894
2985
  return new Promise((t) => this.exportHtml(t, e));
@@ -2924,15 +3015,15 @@ let B = class extends $ {
2924
3015
  */
2925
3016
  preloadLazyTools() {
2926
3017
  const e = window.requestIdleCallback ?? ((t) => setTimeout(t, 1e3));
2927
- for (const { meta: t } of st)
3018
+ for (const { meta: t } of rt)
2928
3019
  e(() => {
2929
3020
  this.toolRegistry.ensureLoaded(t.name);
2930
3021
  });
2931
3022
  }
2932
3023
  registerBuiltInTools() {
2933
- for (const e of Pt)
3024
+ for (const e of Et)
2934
3025
  this.toolRegistry.register(e);
2935
- for (const { meta: e, loader: t } of st)
3026
+ for (const { meta: e, loader: t } of rt)
2936
3027
  this.toolRegistry.registerLazy(e, t);
2937
3028
  }
2938
3029
  applyOptions() {
@@ -2970,10 +3061,10 @@ B.styles = k`
2970
3061
  }
2971
3062
  * { box-sizing: border-box; }
2972
3063
  `;
2973
- ct([
3064
+ pt([
2974
3065
  b({ type: Object })
2975
3066
  ], B.prototype, "options", 2);
2976
- B = ct([
3067
+ B = pt([
2977
3068
  C("mail-editor")
2978
3069
  ], B);
2979
3070
  function _(e, t) {
@@ -2982,20 +3073,20 @@ function _(e, t) {
2982
3073
  _("mail-editor", B);
2983
3074
  _("me-editor-canvas", M);
2984
3075
  _("me-row-renderer", R);
2985
- _("me-column-renderer", S);
2986
- _("me-content-renderer", D);
3076
+ _("me-column-renderer", D);
3077
+ _("me-content-renderer", S);
2987
3078
  _("me-editor-sidebar", P);
2988
3079
  _("me-body-settings", A);
2989
3080
  _("me-property-panel", E);
2990
3081
  _("me-inline-toolbar", V);
2991
- const we = customElements.get("mail-editor") !== void 0;
3082
+ const $e = customElements.get("mail-editor") !== void 0;
2992
3083
  export {
2993
- we as E,
3084
+ $e as E,
2994
3085
  B as M,
2995
- $t as T,
2996
- vt as a,
3086
+ kt as T,
3087
+ $t as a,
2997
3088
  z as e,
2998
- ye as j,
3089
+ ve as j,
2999
3090
  l as s
3000
3091
  };
3001
- //# sourceMappingURL=index-BoKIXJKv.js.map
3092
+ //# sourceMappingURL=index-CpMbWdgn.js.map