best-email-builder 0.19.0 → 0.20.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 (39) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/ai-server.js +3 -3
  3. package/dist/ai.js +6 -6
  4. package/dist/builder.js +8 -8
  5. package/dist/{chunk-BMCXSP4Q.js → chunk-2N6YC6JN.js} +2 -2
  6. package/dist/{chunk-WYYATB37.js → chunk-ACJQTHMG.js} +164 -35
  7. package/dist/chunk-ACJQTHMG.js.map +1 -0
  8. package/dist/{chunk-MW3ZGK34.js → chunk-DLQYMFN7.js} +13 -1
  9. package/dist/chunk-DLQYMFN7.js.map +1 -0
  10. package/dist/{chunk-4662C22G.js → chunk-EAE6R7EQ.js} +3 -3
  11. package/dist/{chunk-K43QP3TX.js → chunk-FJ6IJO3K.js} +3 -3
  12. package/dist/{chunk-UR3UTVC5.js → chunk-LYGVIQGG.js} +4 -4
  13. package/dist/{chunk-GUF6MIXZ.js → chunk-Q2J547BE.js} +2 -2
  14. package/dist/{chunk-NSNODUL6.js → chunk-RCN6FCCK.js} +3 -3
  15. package/dist/{chunk-CYTZO2MW.js → chunk-RZPCNCWF.js} +3 -3
  16. package/dist/{chunk-CYTZO2MW.js.map → chunk-RZPCNCWF.js.map} +1 -1
  17. package/dist/{chunk-HWNNYG45.js → chunk-THOQ3RVD.js} +2 -2
  18. package/dist/{chunk-LJXCMXYI.js → chunk-VLBVJJ4X.js} +2 -2
  19. package/dist/index.js +10 -10
  20. package/dist/library.js +5 -5
  21. package/dist/server.js +5 -5
  22. package/dist/styles.css +1 -1
  23. package/dist/types/core/EmailEditor.d.ts +4 -0
  24. package/dist/types/core/constants.d.ts +1 -1
  25. package/dist/types/engine/NativeAdapter.d.ts +1 -1
  26. package/dist/types/engine/canvas/CanvasView.d.ts +4 -0
  27. package/dist/types/engine/canvas/canvasStyles.d.ts +1 -1
  28. package/dist/types/features/variables/VariablesPanel.d.ts +1 -2
  29. package/package.json +1 -1
  30. package/dist/chunk-MW3ZGK34.js.map +0 -1
  31. package/dist/chunk-WYYATB37.js.map +0 -1
  32. /package/dist/{chunk-BMCXSP4Q.js.map → chunk-2N6YC6JN.js.map} +0 -0
  33. /package/dist/{chunk-4662C22G.js.map → chunk-EAE6R7EQ.js.map} +0 -0
  34. /package/dist/{chunk-K43QP3TX.js.map → chunk-FJ6IJO3K.js.map} +0 -0
  35. /package/dist/{chunk-UR3UTVC5.js.map → chunk-LYGVIQGG.js.map} +0 -0
  36. /package/dist/{chunk-GUF6MIXZ.js.map → chunk-Q2J547BE.js.map} +0 -0
  37. /package/dist/{chunk-NSNODUL6.js.map → chunk-RCN6FCCK.js.map} +0 -0
  38. /package/dist/{chunk-HWNNYG45.js.map → chunk-THOQ3RVD.js.map} +0 -0
  39. /package/dist/{chunk-LJXCMXYI.js.map → chunk-VLBVJJ4X.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,31 @@ All notable changes are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.20.0] — 2026-10-30
10
+
11
+ ### Added
12
+ - Column widths by hand: with a layout selected, or anything inside it, the
13
+ lines between its columns can be dragged on the canvas (or moved with the
14
+ arrow keys, Shift for 5 %). Only the two columns beside the line change,
15
+ never below 10 %; the whole drag is one undo step.
16
+ - A menu link has a line height.
17
+ - `parentId` on a selected element: the element it is in.
18
+
19
+ ### Fixed
20
+ - Bold on a column, a section or a menu: every text, button and menu link
21
+ inside takes the weight.
22
+ - Every ribbon icon acts on a menu link and on a menu: bold, italic,
23
+ underline, strikethrough, clear formatting (their weight, slant and lines
24
+ go), line height, alignment (a link's is its menu's); the link and remove
25
+ the link change a menu link's address, a button's or an image's. A whole
26
+ menu keeps the link off: one address for all its links would make no sense.
27
+ - The unsubscribe link of the Variables panel behaves like every variable:
28
+ its tag (`{{ unsubscribe }}`) is typed and previewed, no longer a ready-made
29
+ "Unsubscribe" link. As an address, it is picked from the `{ }` of the link
30
+ field.
31
+ - The variables of a field open under it, flush with its edges, rather than
32
+ hanging off the `{ }` button.
33
+
9
34
  ## [0.19.0] — 2026-10-30
10
35
 
11
36
  ### Added
package/dist/ai-server.js CHANGED
@@ -28,9 +28,9 @@ import {
28
28
  reviewFix,
29
29
  reviewRewrite,
30
30
  reviewSubjects
31
- } from "./chunk-4662C22G.js";
32
- import "./chunk-LJXCMXYI.js";
33
- import "./chunk-MW3ZGK34.js";
31
+ } from "./chunk-EAE6R7EQ.js";
32
+ import "./chunk-VLBVJJ4X.js";
33
+ import "./chunk-DLQYMFN7.js";
34
34
 
35
35
  // src/ai/agentEndpoint.js
36
36
  var TASKS = ["rewrite", "subjects"];
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cleanRichText
3
- } from "./chunk-GUF6MIXZ.js";
3
+ } from "./chunk-Q2J547BE.js";
4
4
  import {
5
5
  Button,
6
6
  Dialog,
@@ -20,8 +20,8 @@ import {
20
20
  cn,
21
21
  createHttpCaller,
22
22
  useUi
23
- } from "./chunk-K43QP3TX.js";
24
- import "./chunk-CYTZO2MW.js";
23
+ } from "./chunk-FJ6IJO3K.js";
24
+ import "./chunk-RZPCNCWF.js";
25
25
  import {
26
26
  AGENT_ERROR_CODES,
27
27
  AGENT_PROTOCOL,
@@ -46,9 +46,9 @@ import {
46
46
  providerEmailModel,
47
47
  resolveProvider,
48
48
  visibleText
49
- } from "./chunk-4662C22G.js";
50
- import "./chunk-LJXCMXYI.js";
51
- import "./chunk-MW3ZGK34.js";
49
+ } from "./chunk-EAE6R7EQ.js";
50
+ import "./chunk-VLBVJJ4X.js";
51
+ import "./chunk-DLQYMFN7.js";
52
52
 
53
53
  // src/ai/keys.js
54
54
  var STORAGE_PREFIX = "best-email-builder:ai-key:";
package/dist/builder.js CHANGED
@@ -5,20 +5,20 @@ import {
5
5
  TEMPLATE_GALLERY,
6
6
  buildGallery,
7
7
  createStarterMjml
8
- } from "./chunk-WYYATB37.js";
9
- import "./chunk-NSNODUL6.js";
10
- import "./chunk-HWNNYG45.js";
8
+ } from "./chunk-ACJQTHMG.js";
9
+ import "./chunk-RCN6FCCK.js";
10
+ import "./chunk-THOQ3RVD.js";
11
11
  import "./chunk-UFKCLU2D.js";
12
- import "./chunk-GUF6MIXZ.js";
12
+ import "./chunk-Q2J547BE.js";
13
13
  import {
14
14
  StorageError,
15
15
  createHttpStorage,
16
16
  createMemoryStorage
17
- } from "./chunk-K43QP3TX.js";
17
+ } from "./chunk-FJ6IJO3K.js";
18
18
  import {
19
19
  EMAIL_BUILDER_VERSION
20
- } from "./chunk-CYTZO2MW.js";
21
- import "./chunk-LJXCMXYI.js";
20
+ } from "./chunk-RZPCNCWF.js";
21
+ import "./chunk-VLBVJJ4X.js";
22
22
  import {
23
23
  CUSTOM_GROUP,
24
24
  DEFAULT_VARIABLES,
@@ -28,7 +28,7 @@ import {
28
28
  defineVariables,
29
29
  mergeVariables,
30
30
  translatorFor
31
- } from "./chunk-MW3ZGK34.js";
31
+ } from "./chunk-DLQYMFN7.js";
32
32
  export {
33
33
  CUSTOM_GROUP,
34
34
  DEFAULT_VARIABLES,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_VARIABLES
3
- } from "./chunk-MW3ZGK34.js";
3
+ } from "./chunk-DLQYMFN7.js";
4
4
 
5
5
  // src/features/variables/service.js
6
6
  function escapeHtml(text) {
@@ -70,4 +70,4 @@ export {
70
70
  unknownVariables,
71
71
  sampleValues
72
72
  };
73
- //# sourceMappingURL=chunk-BMCXSP4Q.js.map
73
+ //# sourceMappingURL=chunk-2N6YC6JN.js.map
@@ -6,7 +6,7 @@ import {
6
6
  useLayoutWidth,
7
7
  useSearchShortcut,
8
8
  withThumbnailImages
9
- } from "./chunk-NSNODUL6.js";
9
+ } from "./chunk-RCN6FCCK.js";
10
10
  import {
11
11
  BORDER_STYLES,
12
12
  BRAND_NOTES,
@@ -22,12 +22,12 @@ import {
22
22
  parseSpacing,
23
23
  toAttributes,
24
24
  toValues
25
- } from "./chunk-HWNNYG45.js";
25
+ } from "./chunk-THOQ3RVD.js";
26
26
  import {
27
27
  cleanRichText,
28
28
  escapeText,
29
29
  textOfHtml
30
- } from "./chunk-GUF6MIXZ.js";
30
+ } from "./chunk-Q2J547BE.js";
31
31
  import {
32
32
  Button,
33
33
  Dialog,
@@ -68,7 +68,7 @@ import {
68
68
  createHttpStorage,
69
69
  useT,
70
70
  useUi
71
- } from "./chunk-K43QP3TX.js";
71
+ } from "./chunk-FJ6IJO3K.js";
72
72
  import {
73
73
  BRAND_FONT_SIZES,
74
74
  DEFAULT_BUTTON_URL,
@@ -113,11 +113,11 @@ import {
113
113
  setAttributes,
114
114
  setContent,
115
115
  toProject
116
- } from "./chunk-CYTZO2MW.js";
116
+ } from "./chunk-RZPCNCWF.js";
117
117
  import {
118
118
  IMAGE_ATTRIBUTES,
119
119
  isSafeUrl
120
- } from "./chunk-LJXCMXYI.js";
120
+ } from "./chunk-VLBVJJ4X.js";
121
121
  import {
122
122
  CUSTOM_GROUP,
123
123
  DEFAULT_VARIABLES,
@@ -133,7 +133,7 @@ import {
133
133
  translatorFor,
134
134
  validateCustomVariable,
135
135
  validateVariableEdit
136
- } from "./chunk-MW3ZGK34.js";
136
+ } from "./chunk-DLQYMFN7.js";
137
137
 
138
138
  // src/core/events.js
139
139
  function createEmitter({ onError } = {}) {
@@ -967,6 +967,7 @@ var navbarLinkBlock = {
967
967
  prop.color("Text"),
968
968
  prop.fontFamily(),
969
969
  prop.fontSize(10, 24),
970
+ prop.lineHeight(),
970
971
  {
971
972
  // MJML writes menu links in capitals unless told otherwise.
972
973
  key: "text-transform",
@@ -1426,7 +1427,7 @@ import { Braces as Braces2 } from "lucide-react";
1426
1427
 
1427
1428
  // src/features/variables/VariablesPanel.jsx
1428
1429
  import { Fragment, useEffect as useEffect2, useRef, useState as useState3 } from "react";
1429
- import { FolderPlus, Link2, Loader2 as Loader22, Pencil, Plus, Trash2 as Trash22 } from "lucide-react";
1430
+ import { FolderPlus, Loader2 as Loader22, Pencil, Plus, Trash2 as Trash22 } from "lucide-react";
1430
1431
 
1431
1432
  // src/features/variables/VariableDialog.jsx
1432
1433
  import { useEffect, useMemo, useState as useState2 } from "react";
@@ -1780,7 +1781,7 @@ function VariablesPanel({ context }) {
1780
1781
  const from = groupOf(variable);
1781
1782
  const over = groupAt(event.currentTarget, event.clientX, event.clientY);
1782
1783
  start.over = over !== from ? over : null;
1783
- setDrag({ key: variable.key, label, link: variable.kind === "link", from, over: start.over, x: event.clientX, y: event.clientY });
1784
+ setDrag({ key: variable.key, label, from, over: start.over, x: event.clientX, y: event.clientY });
1784
1785
  },
1785
1786
  onPointerUp: () => {
1786
1787
  const start = press.current;
@@ -1800,31 +1801,27 @@ function VariablesPanel({ context }) {
1800
1801
  }
1801
1802
  });
1802
1803
  const insert = (variable) => {
1803
- const done = variable.kind === "link" ? editor.insertLink(tokenOf(variable), t("Unsubscribe")) : editor.insertText(tokenOf(variable));
1804
+ const done = editor.insertText(tokenOf(variable));
1804
1805
  if (!done) notify("info", t("Select a text or a button first."));
1805
1806
  };
1806
1807
  const badge = (variable) => {
1807
- const link2 = variable.kind === "link";
1808
1808
  const label = labelOf(variable, t);
1809
- const button2 = /* @__PURE__ */ jsxs3(
1809
+ const button2 = /* @__PURE__ */ jsx3(
1810
1810
  "button",
1811
1811
  {
1812
1812
  type: "button",
1813
1813
  disabled: !ready,
1814
1814
  "data-variable": variable.key,
1815
- onMouseEnter: link2 ? void 0 : () => !drag && editor.previewText(tokenOf(variable)),
1816
- onMouseLeave: link2 ? void 0 : () => editor.clearPreview(),
1817
- onFocus: link2 ? void 0 : () => editor.previewText(tokenOf(variable)),
1818
- onBlur: link2 ? void 0 : () => editor.clearPreview(),
1815
+ onMouseEnter: () => !drag && editor.previewText(tokenOf(variable)),
1816
+ onMouseLeave: () => editor.clearPreview(),
1817
+ onFocus: () => editor.previewText(tokenOf(variable)),
1818
+ onBlur: () => editor.clearPreview(),
1819
1819
  onClick: () => {
1820
1820
  if (!press.current?.dragged) insert(variable);
1821
1821
  },
1822
1822
  ...canManageVariables ? dragHandlers(variable, label) : {},
1823
1823
  className: cn(BADGE, canManageVariables && "eb:cursor-grab eb:rounded-r-none eb:border-r-0 eb:pr-1.5 eb:active:cursor-grabbing"),
1824
- children: [
1825
- link2 && /* @__PURE__ */ jsx3(Link2, { className: "eb:size-3", "aria-hidden": "true" }),
1826
- label
1827
- ]
1824
+ children: label
1828
1825
  }
1829
1826
  );
1830
1827
  const tip = /* @__PURE__ */ jsx3(TooltipWrap, { label: /* @__PURE__ */ jsx3("code", { className: "eb:font-mono", children: tokenOf(variable) }), delayDuration: 100, hoverable: false, hidden: Boolean(drag), children: button2 });
@@ -1931,16 +1928,13 @@ function VariablesPanel({ context }) {
1931
1928
  ]
1932
1929
  }
1933
1930
  ),
1934
- drag && /* @__PURE__ */ jsxs3(
1931
+ drag && /* @__PURE__ */ jsx3(
1935
1932
  "span",
1936
1933
  {
1937
1934
  "aria-hidden": "true",
1938
1935
  className: cn(BADGE, "eb:pointer-events-none eb:fixed eb:z-50 eb:border-primary/50 eb:text-primary eb:shadow-md"),
1939
1936
  style: { left: drag.x + 10, top: drag.y + 10 },
1940
- children: [
1941
- drag.link && /* @__PURE__ */ jsx3(Link2, { className: "eb:size-3", "aria-hidden": "true" }),
1942
- drag.label
1943
- ]
1937
+ children: drag.label
1944
1938
  }
1945
1939
  ),
1946
1940
  canManageVariables && /* @__PURE__ */ jsx3(
@@ -3629,6 +3623,14 @@ td.eb-placeholder { outline: 1.5px dashed #c3cad6; outline-offset: -8px; }
3629
3623
  box-shadow: 0 0 0 2px #fff, 0 3px 10px -3px color-mix(in oklab, ${PRIMARY} 70%, transparent); transition: transform 0.12s ease; }
3630
3624
  .eb-ui-add:hover, .eb-ui-add:focus-visible { transform: scale(1.15); }
3631
3625
  .eb-ui-add svg { width: 14px; height: 14px; stroke-width: 2.75; }
3626
+ .eb-ui-column-border { position: absolute; width: 11px; margin-left: -5.5px; cursor: col-resize; pointer-events: auto;
3627
+ touch-action: none; outline: none; }
3628
+ .eb-ui-column-border::before { content: ''; position: absolute; top: 0; bottom: 0; left: 4.5px; width: 2px; border-radius: 1px;
3629
+ background: color-mix(in oklab, ${PRIMARY} 45%, transparent); transition: background 0.12s ease; }
3630
+ .eb-ui-column-border::after { content: ''; position: absolute; top: 50%; left: 2.5px; width: 6px; height: 24px; margin-top: -12px;
3631
+ border-radius: 3px; background: ${PRIMARY}; box-shadow: 0 0 0 1.5px #fff; }
3632
+ .eb-ui-column-border:hover::before, .eb-ui-column-border:focus-visible::before, .eb-ui-column-border[data-active]::before {
3633
+ background: ${PRIMARY}; }
3632
3634
  .eb-ui-drop { position: absolute; height: 4px; margin-top: -2px; border-radius: 2px; background: ${PRIMARY};
3633
3635
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); pointer-events: none; }
3634
3636
  .eb-ui-drop::before, .eb-ui-drop::after { content: ''; position: absolute; top: -3px; width: 10px; height: 10px;
@@ -3771,6 +3773,8 @@ function createCanvasView(options) {
3771
3773
  tagClear.hidden = true;
3772
3774
  tagClear.innerHTML = ICONS.x;
3773
3775
  ui.appendChild(tagClear);
3776
+ const columnBorders = doc.createElement("div");
3777
+ ui.appendChild(columnBorders);
3774
3778
  const workBox = make("eb-ui-box eb-ui-working");
3775
3779
  workBox.setAttribute("data-testid", "eb-canvas-working");
3776
3780
  let selectedId = null;
@@ -3877,6 +3881,70 @@ function createCanvasView(options) {
3877
3881
  tools.style.left = `${Math.max(afterChip, box.left + box.width - toolsWidth)}px`;
3878
3882
  drawAdd(box, details);
3879
3883
  }
3884
+ const COLUMN_MIN = 10;
3885
+ function rowAround(id) {
3886
+ const path = pathTo(getRoot(), id) || [];
3887
+ for (let i = path.length - 1; i >= 0; i -= 1) {
3888
+ if (path[i].children.filter((child) => child.tag === "mj-column").length > 1) return path[i];
3889
+ }
3890
+ return null;
3891
+ }
3892
+ function shownColumns(row) {
3893
+ const columns = row.children.filter((child) => child.tag === "mj-column");
3894
+ const found = columns.map((column2) => docBoxOf(column2.id));
3895
+ if (!found.every(Boolean)) return null;
3896
+ const boxes = (
3897
+ /** @type {{top: number, left: number, width: number, height: number}[]} */
3898
+ found
3899
+ );
3900
+ if (boxes.some((box, i) => i > 0 && Math.abs(box.top - boxes[0].top) > 2)) return null;
3901
+ const total = boxes.reduce((sum, box) => sum + box.width, 0);
3902
+ return { ids: columns.map((column2) => column2.id), boxes, total, shares: boxes.map((box) => box.width / total * 100) };
3903
+ }
3904
+ function sharesAfter(shares, index, delta) {
3905
+ const pair = shares[index] + shares[index + 1];
3906
+ const left = Math.round(Math.min(pair - COLUMN_MIN, Math.max(COLUMN_MIN, Math.round(shares[index] + delta))) * 100) / 100;
3907
+ const next = shares.map((share) => Math.round(share * 100) / 100);
3908
+ next[index] = left;
3909
+ next[index + 1] = Math.round((pair - left) * 100) / 100;
3910
+ return next;
3911
+ }
3912
+ const resizeColumns = (ids, shares) => options.onResizeColumns?.(Object.fromEntries(ids.map((id, i) => [id, `${shares[i]}%`])));
3913
+ function drawColumnBorders() {
3914
+ const row = selectedId && !editingId && !drag && options.onResizeColumns ? rowAround(selectedId) : null;
3915
+ const shown = row ? shownColumns(row) : null;
3916
+ const count = shown ? shown.ids.length - 1 : 0;
3917
+ while (columnBorders.children.length > count) columnBorders.lastElementChild?.remove();
3918
+ while (columnBorders.children.length < count) {
3919
+ const border = doc.createElement("div");
3920
+ border.className = "eb-ui-column-border";
3921
+ border.tabIndex = 0;
3922
+ border.setAttribute("role", "separator");
3923
+ border.setAttribute("aria-orientation", "vertical");
3924
+ border.setAttribute("data-testid", "eb-canvas-column-border");
3925
+ columnBorders.appendChild(border);
3926
+ }
3927
+ if (!shown || !row) return;
3928
+ const top = Math.min(...shown.boxes.map((box) => box.top));
3929
+ const bottom = Math.max(...shown.boxes.map((box) => box.top + box.height));
3930
+ [...columnBorders.children].forEach((element, i) => {
3931
+ const border = (
3932
+ /** @type {HTMLElement} */
3933
+ element
3934
+ );
3935
+ const box = shown.boxes[i];
3936
+ border.style.top = `${top}px`;
3937
+ border.style.left = `${box.left + box.width}px`;
3938
+ border.style.height = `${bottom - top}px`;
3939
+ border.dataset.row = row.id;
3940
+ border.dataset.index = String(i);
3941
+ border.title = t("Drag to change the widths of the columns");
3942
+ border.setAttribute("aria-label", t("Column width"));
3943
+ border.setAttribute("aria-valuenow", String(Math.round(shown.shares[i])));
3944
+ border.setAttribute("aria-valuemin", String(COLUMN_MIN));
3945
+ border.setAttribute("aria-valuemax", String(Math.round(shown.shares[i] + shown.shares[i + 1] - COLUMN_MIN)));
3946
+ });
3947
+ }
3880
3948
  function drawAdd(box, details) {
3881
3949
  const SIZE = 22;
3882
3950
  const busy = Boolean(editingId || drag);
@@ -3919,6 +3987,7 @@ function createCanvasView(options) {
3919
3987
  if (destroyed) return;
3920
3988
  drawMulti();
3921
3989
  drawSelection();
3990
+ drawColumnBorders();
3922
3991
  drawHover();
3923
3992
  drawTag();
3924
3993
  drawWorking();
@@ -4211,6 +4280,46 @@ function createCanvasView(options) {
4211
4280
  savedRange = selection.rangeCount ? selection.getRangeAt(0).cloneRange() : null;
4212
4281
  } else options.onRemoveTag(at.id, at.index);
4213
4282
  });
4283
+ const borderOf = (event) => {
4284
+ const border = (
4285
+ /** @type {HTMLElement|null} */
4286
+ /** @type {Element} */
4287
+ event.target.closest?.(".eb-ui-column-border")
4288
+ );
4289
+ const row = border?.dataset.row ? findNodeIn(border.dataset.row) : null;
4290
+ const shown = row ? shownColumns(row) : null;
4291
+ return border && shown ? { border, shown, index: Number(border.dataset.index) } : null;
4292
+ };
4293
+ const findNodeIn = (id) => (pathTo(getRoot(), id) || []).at(-1) || null;
4294
+ columnBorders.addEventListener("pointerdown", (event) => {
4295
+ const at = event.button === 0 ? borderOf(event) : null;
4296
+ if (!at) return;
4297
+ event.preventDefault();
4298
+ event.stopPropagation();
4299
+ const { border, shown, index } = at;
4300
+ const startX = event.clientX;
4301
+ border.setPointerCapture(event.pointerId);
4302
+ border.dataset.active = "";
4303
+ const move = (e) => resizeColumns(shown.ids, sharesAfter(shown.shares, index, (e.clientX - startX) / shown.total * 100));
4304
+ const end = () => {
4305
+ delete border.dataset.active;
4306
+ border.removeEventListener("pointermove", move);
4307
+ border.removeEventListener("pointerup", end);
4308
+ border.removeEventListener("pointercancel", end);
4309
+ };
4310
+ border.addEventListener("pointermove", move);
4311
+ border.addEventListener("pointerup", end);
4312
+ border.addEventListener("pointercancel", end);
4313
+ });
4314
+ columnBorders.addEventListener("keydown", (event) => {
4315
+ const step = { ArrowLeft: -1, ArrowRight: 1 }[event.key];
4316
+ const at = step ? borderOf(event) : null;
4317
+ if (!at || !step) return;
4318
+ event.preventDefault();
4319
+ event.stopPropagation();
4320
+ resizeColumns(at.shown.ids, sharesAfter(at.shown.shares, at.index, step * (event.shiftKey ? 5 : 1)));
4321
+ });
4322
+ columnBorders.addEventListener("click", (event) => event.stopPropagation());
4214
4323
  tools.addEventListener("click", (event) => {
4215
4324
  const button2 = (
4216
4325
  /** @type {Element} */
@@ -4950,6 +5059,7 @@ function createNativeAdapter({ loadCompiler = defaultLoadCompiler, imageUrl = nu
4950
5059
  content: LABEL_TAGS.has(node.tag) ? textOfHtml(node.content || "") : null,
4951
5060
  html: node.tag === "mj-text" ? node.content || "" : null,
4952
5061
  children: node.children.map((child) => child.id),
5062
+ parentId: parentOf(root, id)?.id || null,
4953
5063
  canRemove: !locked,
4954
5064
  canDuplicate: !locked,
4955
5065
  canMoveUp: !locked && index > 0,
@@ -5369,6 +5479,12 @@ function createNativeAdapter({ loadCompiler = defaultLoadCompiler, imageUrl = nu
5369
5479
  if (payload.nodeId) moveTo(payload.nodeId, target);
5370
5480
  else if (payload.block) insertBlock(payload.block, target);
5371
5481
  },
5482
+ // A border between columns dragged: one step of history for the whole drag.
5483
+ onResizeColumns: (widths) => {
5484
+ let next = requireRoot();
5485
+ for (const [id, width] of Object.entries(widths)) next = setAttributes(next, id, { width });
5486
+ commit(next, { merge: `columns:${Object.keys(widths).join("+")}` });
5487
+ },
5372
5488
  onEditStart: () => {
5373
5489
  history.key = null;
5374
5490
  },
@@ -6798,7 +6914,8 @@ function VariableInsertButton({ variables, inputRef, value, onChange, label, lin
6798
6914
  };
6799
6915
  return /* @__PURE__ */ jsxs14(Popover, { open, onOpenChange: setOpen, children: [
6800
6916
  /* @__PURE__ */ jsx15(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(Button, { variant: "ghost", size: "icon-xs", "aria-label": label, title: label, children: /* @__PURE__ */ jsx15(Braces3, {}) }) }),
6801
- /* @__PURE__ */ jsx15(PopoverContent, { align: "end", className: "eb:w-72 eb:p-0", onCloseAutoFocus: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx15(VariablePicker, { variables, onPick: insert, filter: links ? void 0 : (v) => v.kind !== "link" }) })
6917
+ /* @__PURE__ */ jsx15(PopoverAnchor, { virtualRef: inputRef }),
6918
+ /* @__PURE__ */ jsx15(PopoverContent, { align: "start", className: "eb:w-(--radix-popover-trigger-width) eb:min-w-64 eb:p-0", onCloseAutoFocus: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx15(VariablePicker, { variables, onPick: insert, filter: links ? void 0 : (v) => v.kind !== "link" }) })
6802
6919
  ] });
6803
6920
  }
6804
6921
 
@@ -6876,7 +6993,12 @@ function TextRibbon({ editor, ready, selection, format, variables = [], drawers,
6876
6993
  }
6877
6994
  };
6878
6995
  if (element) walk(element.children);
6879
- const targetsOf = (key) => element && own(element, key) ? [element] : inside.filter((target) => own(target, key));
6996
+ const parent = element?.parentId ? editor.getElement(element.parentId) : null;
6997
+ const targetsOf = (key) => {
6998
+ if (element && own(element, key)) return [element];
6999
+ const found = inside.filter((target) => own(target, key));
7000
+ return found.length || !parent || !own(parent, key) ? found : [parent];
7001
+ };
6880
7002
  const propertyOf = (key) => {
6881
7003
  const [first] = targetsOf(key);
6882
7004
  return first ? own(first, key) : null;
@@ -6898,12 +7020,19 @@ function TextRibbon({ editor, ready, selection, format, variables = [], drawers,
6898
7020
  const [attribute, on, off] = STYLES[command];
6899
7021
  editor.updateProperties({ [attribute]: styleOn(command) ? off : on }, styledTargets.map((target) => target.id));
6900
7022
  };
6901
- const weight = !format.editing ? propertyOf("font-weight") : null;
6902
- const bold = weight ? heavy(valueOf("font-weight")) || format.bold : format.bold;
7023
+ const weightOf = (target) => target.attributes?.["font-weight"] || target.values?.["font-weight"] || target.defaults?.["font-weight"] || "";
7024
+ const weightOn = styledTargets.length > 0 && styledTargets.every((target) => heavy(weightOf(target)));
7025
+ const textWeight = words && !format.editing && element ? heavy(weightOf(element)) : false;
7026
+ const bold = styled ? weightOn : format.bold || textWeight;
6903
7027
  const toggleBold = () => {
6904
- if (weight && (heavy(valueOf("font-weight")) || !words && !format.bold)) set("font-weight", heavy(valueOf("font-weight")) ? "normal" : "bold");
7028
+ if (styled) editor.updateProperties({ "font-weight": weightOn ? "normal" : "bold" }, styledTargets.map((target) => target.id));
7029
+ else if (textWeight && element) editor.updateProperties({ "font-weight": "normal" }, element.id);
6905
7030
  else run("bold");
6906
7031
  };
7032
+ const hrefTargets = words ? [] : targetsOf("href");
7033
+ const linked = hrefTargets.length === 1;
7034
+ const href = words ? format.link || "" : linked ? valueOf("href") : "";
7035
+ const clearStyles = () => editor.updateProperties({ "font-weight": null, "font-style": null, "text-decoration": null }, styledTargets.map((target) => target.id));
6907
7036
  const font = propertyOf("font-family");
6908
7037
  const fontValue = font?.options?.find((option) => fontKey(option.value) === fontKey(valueOf("font-family")))?.value;
6909
7038
  const color = propertyOf("color");
@@ -6942,7 +7071,7 @@ function TextRibbon({ editor, ready, selection, format, variables = [], drawers,
6942
7071
  {
6943
7072
  type: "button",
6944
7073
  className: ICON_BUTTON,
6945
- disabled: command === "bold" ? !words && !weight : !words && !styled,
7074
+ disabled: !words && !styled,
6946
7075
  "aria-label": t(label),
6947
7076
  "aria-pressed": Boolean(command === "bold" ? bold : styled ? styleOn(command) : format[command]),
6948
7077
  "data-command": command,
@@ -6980,10 +7109,10 @@ function TextRibbon({ editor, ready, selection, format, variables = [], drawers,
6980
7109
  ] }, option.value)) })
6981
7110
  ] }),
6982
7111
  /* @__PURE__ */ jsx16(Separator2, {}),
6983
- /* @__PURE__ */ jsx16(LinkButton, { disabled: !words, href: format.link || "", variables, onApply: (href) => run("link", href) }),
6984
- /* @__PURE__ */ jsx16(Tip, { label: t("Remove the link"), children: /* @__PURE__ */ jsx16("button", { type: "button", className: ICON_BUTTON, disabled: !words || !format.link, "aria-label": t("Remove the link"), "data-command": "unlink", onClick: () => run("unlink"), children: /* @__PURE__ */ jsx16(Unlink, { "aria-hidden": "true" }) }) }),
7112
+ /* @__PURE__ */ jsx16(LinkButton, { disabled: !words && !linked, href, variables, onApply: (next) => words ? run("link", next) : set("href", next) }),
7113
+ /* @__PURE__ */ jsx16(Tip, { label: t("Remove the link"), children: /* @__PURE__ */ jsx16("button", { type: "button", className: ICON_BUTTON, disabled: !href, "aria-label": t("Remove the link"), "data-command": "unlink", onClick: () => words ? run("unlink") : set("href", null), children: /* @__PURE__ */ jsx16(Unlink, { "aria-hidden": "true" }) }) }),
6985
7114
  /* @__PURE__ */ jsx16(Separator2, {}),
6986
- /* @__PURE__ */ jsx16(Tip, { label: t("Clear formatting"), children: /* @__PURE__ */ jsx16("button", { type: "button", className: ICON_BUTTON, disabled: !words, "aria-label": t("Clear formatting"), "data-command": "clear", onClick: () => run("clear"), children: /* @__PURE__ */ jsx16(RemoveFormatting, { "aria-hidden": "true" }) }) }),
7115
+ /* @__PURE__ */ jsx16(Tip, { label: t("Clear formatting"), children: /* @__PURE__ */ jsx16("button", { type: "button", className: ICON_BUTTON, disabled: !words && !styled, "aria-label": t("Clear formatting"), "data-command": "clear", onClick: () => words ? run("clear") : clearStyles(), children: /* @__PURE__ */ jsx16(RemoveFormatting, { "aria-hidden": "true" }) }) }),
6987
7116
  /* @__PURE__ */ jsx16(Separator2, {}),
6988
7117
  /* @__PURE__ */ jsx16(SizeField2, { property: size, value: currentSize, onCommit: (n) => set("font-size", `${clamp(n, size)}px`) }),
6989
7118
  /* @__PURE__ */ jsxs15(DropdownMenu, { modal: false, children: [
@@ -8452,4 +8581,4 @@ export {
8452
8581
  EmailBuilder,
8453
8582
  EmailBuilderBoundary
8454
8583
  };
8455
- //# sourceMappingURL=chunk-WYYATB37.js.map
8584
+ //# sourceMappingURL=chunk-ACJQTHMG.js.map