best-email-builder 0.13.1 → 0.15.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 (64) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/ai-server.js +3 -3
  3. package/dist/ai.js +63 -49
  4. package/dist/ai.js.map +1 -1
  5. package/dist/builder.js +10 -8
  6. package/dist/{chunk-UGF3YJ64.js → chunk-6LTSEPQX.js} +2 -2
  7. package/dist/{chunk-NPE7WFT5.js → chunk-6ZX3VYE4.js} +19 -4
  8. package/dist/chunk-6ZX3VYE4.js.map +1 -0
  9. package/dist/{chunk-P6IEVWZY.js → chunk-AT4EB2NS.js} +2 -2
  10. package/dist/{chunk-2KOI5SWV.js → chunk-GHFNJY4O.js} +2 -2
  11. package/dist/{chunk-XF25DLD4.js → chunk-I6FP6BBI.js} +3 -3
  12. package/dist/{chunk-2IDNT724.js → chunk-ND3B5TL7.js} +136 -120
  13. package/dist/chunk-ND3B5TL7.js.map +1 -0
  14. package/dist/{chunk-EKQA3YAI.js → chunk-OK3EIEUA.js} +1239 -789
  15. package/dist/chunk-OK3EIEUA.js.map +1 -0
  16. package/dist/{chunk-RVRKAXYC.js → chunk-QXE6LJG5.js} +73 -73
  17. package/dist/chunk-QXE6LJG5.js.map +1 -0
  18. package/dist/{chunk-SYQC7JNA.js → chunk-RG2DTGST.js} +4 -4
  19. package/dist/{chunk-ZTUW25BG.js → chunk-RZ3O4MH5.js} +119 -29
  20. package/dist/chunk-RZ3O4MH5.js.map +1 -0
  21. package/dist/{chunk-A4KF7NMP.js → chunk-XALUYZYQ.js} +2 -2
  22. package/dist/index.js +12 -10
  23. package/dist/index.js.map +1 -1
  24. package/dist/library.js +5 -5
  25. package/dist/server.js +26 -10
  26. package/dist/server.js.map +1 -1
  27. package/dist/styles.css +1 -1
  28. package/dist/types/builder.d.ts +1 -1
  29. package/dist/types/core/constants.d.ts +1 -1
  30. package/dist/types/engine/NativeAdapter.d.ts +1 -1
  31. package/dist/types/engine/canvas/CanvasView.d.ts +9 -3
  32. package/dist/types/engine/canvas/canvasStyles.d.ts +1 -1
  33. package/dist/types/engine/canvas/icons.d.ts +5 -0
  34. package/dist/types/engine/mergeTags.d.ts +47 -0
  35. package/dist/types/features/brand/brand.d.ts +4 -0
  36. package/dist/types/features/variables/VariableDialog.d.ts +7 -3
  37. package/dist/types/features/variables/VariablePicker.d.ts +2 -2
  38. package/dist/types/features/variables/VariablesBar.d.ts +15 -8
  39. package/dist/types/features/variables/catalog.d.ts +52 -4
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/types/server/index.d.ts +1 -1
  42. package/dist/types/server/variables.d.ts +2 -2
  43. package/dist/types/storage/client.d.ts +2 -1
  44. package/dist/types/ui/PropertiesPanel.d.ts +1 -2
  45. package/dist/types/ui/SidePanel.d.ts +72 -0
  46. package/dist/types/ui/primitives/button.d.ts +1 -1
  47. package/dist/types/ui/primitives/color-picker.d.ts +3 -1
  48. package/dist/types/ui/primitives/fields.d.ts +5 -0
  49. package/dist/types/ui/primitives/overlays.d.ts +3 -1
  50. package/dist/types/ui/primitives/searchShortcut.d.ts +1 -1
  51. package/package.json +1 -1
  52. package/dist/chunk-2IDNT724.js.map +0 -1
  53. package/dist/chunk-EKQA3YAI.js.map +0 -1
  54. package/dist/chunk-NPE7WFT5.js.map +0 -1
  55. package/dist/chunk-RVRKAXYC.js.map +0 -1
  56. package/dist/chunk-ZTUW25BG.js.map +0 -1
  57. package/dist/types/features/variables/VariablesMenu.d.ts +0 -18
  58. package/dist/types/ui/ElementActions.d.ts +0 -13
  59. /package/dist/{chunk-UGF3YJ64.js.map → chunk-6LTSEPQX.js.map} +0 -0
  60. /package/dist/{chunk-P6IEVWZY.js.map → chunk-AT4EB2NS.js.map} +0 -0
  61. /package/dist/{chunk-2KOI5SWV.js.map → chunk-GHFNJY4O.js.map} +0 -0
  62. /package/dist/{chunk-XF25DLD4.js.map → chunk-I6FP6BBI.js.map} +0 -0
  63. /package/dist/{chunk-SYQC7JNA.js.map → chunk-RG2DTGST.js.map} +0 -0
  64. /package/dist/{chunk-A4KF7NMP.js.map → chunk-XALUYZYQ.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,85 @@ All notable changes are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.15.0] — 2026-10-22
10
+
11
+ ### Added
12
+ - A variable in the email, under the pointer, swaps its colors (line by line
13
+ when it runs over two, never the words beside it) and shows a **×** in its
14
+ top-right corner. The × takes the tag out, with the space before it, in a
15
+ text (being edited or not) or a button's label. Ctrl+Z brings it back.
16
+ - The side panels are resized by dragging their border towards the canvas or
17
+ away from it (or with the arrow keys once it is focused; a double-click
18
+ restores the default width), and fold to a narrow rail with the round button
19
+ on that border; the same button, on the rail's border, unfolds them. The
20
+ editor remembers both in the browser.
21
+ - Every variable of the bar can be edited, not only the user's own: the
22
+ pencil of an application's variable changes its name, group, sample value
23
+ and value if empty — never its tag. The storage keeps the edit under the
24
+ variable's key (`PUT /variables/:key`, `saveVariable`) and *Restore the
25
+ default* deletes it. The unsubscribe link stays as it is.
26
+ - *Font size* in the *Brand* dialog, next to the font: paragraphs take it
27
+ (13 to 18 px, line height scaled to match), while headings, buttons and
28
+ footers keep their sizes. `cleanBrand` keeps `fontSize`, `applyBrand` applies
29
+ it.
30
+ - System variables' keys may keep the capitals of an email provider's tags,
31
+ as Brevo's `contact.FIRSTNAME` (custom variables keep lowercase keys).
32
+ - The live demo offers Brevo's contact attributes (first name, last name,
33
+ email address, mobile number) in the variables bar, inserted as Brevo's own
34
+ tags (`{{ contact.FIRSTNAME }}`) and shown with their samples in the
35
+ preview.
36
+
37
+ ### Changed
38
+ - The side panels fold and unfold smoothly, in the time the canvas takes to
39
+ switch to the mobile view (350 ms): their content keeps its width and slides
40
+ out under the border, fading, instead of disappearing at once. With reduced
41
+ motion, they still fold at once. The panel keeps the border with the canvas
42
+ in both states, so no line doubles while it moves.
43
+ - The *Email provider variables* bar no longer covers the email when it
44
+ opens: the email moves down to make room, and back up when the bar closes.
45
+ Under the pointer, it opens after a short pause, so crossing it on the way
46
+ to the email does not move the email.
47
+ - Wider side panels by default: three blocks in a row on the left, and the
48
+ properties about 40% wider.
49
+ - The properties panel no longer has the *Move up* / *Move down* /
50
+ *Duplicate* / *Delete* row: the toolbar of the selection frame on the canvas
51
+ does it. Columns, social icons and menu links, which are not dragged, get
52
+ arrows in that toolbar to move them among their siblings. With every block
53
+ selected (Ctrl+A), the panel keeps a *Delete* button. Its title no longer
54
+ has a line under it.
55
+ - Denser properties: fields, lists and color pickers are 26 px high (all the
56
+ same), the AI action chips 22 px, with less space between the fields.
57
+ - *Write with AI* and *Rewrite with AI* take the instruction in a box of
58
+ several lines: Enter sends it, Shift+Enter starts a new line.
59
+ - A text box (the preview text, a variable's description…) is resized in
60
+ height only: its width stays the panel's, like the other fields.
61
+
62
+ ### Fixed
63
+ - The email preview (the *Preview* dialog and the template library) had two
64
+ scrollbars, the frame's and its box's. The frame now fills the box, so only
65
+ the email scrolls. On a narrow screen, it takes the height the points to
66
+ check leave.
67
+ - The live demo's preview listed its points to check in English whatever the
68
+ page's language; they now follow it, after a switch too.
69
+
70
+ ## [0.14.0] — 2026-10-20
71
+
72
+ ### Changed
73
+ - The *Email provider variables* bar above the canvas (formerly
74
+ *Personalization fields*) is the one place to insert a variable: the
75
+ toolbar's *Variables* menu is gone. The bar now also offers the unsubscribe
76
+ link, *New variable*, and a pencil to edit or delete a custom variable.
77
+ The `{ }` buttons next to *Subject* and *Preview text* keep their search.
78
+ - No variables by default: `DEFAULT_VARIABLES` holds only the unsubscribe
79
+ link, and users create the others with the bar's new **+** button (and edit
80
+ them with the pencil of their badge). The former five (first name, last
81
+ name, email address, company, campaign name) are exported as
82
+ `EXAMPLE_VARIABLES`: pass `[...EXAMPLE_VARIABLES, ...DEFAULT_VARIABLES]` to
83
+ `<EmailBuilder variables>` and `createEmailBuilderHandler({ variables })` to
84
+ keep them.
85
+ - The starter template and the *Welcome* template hold no variable: the
86
+ greeting is "Hello," and the heading "Welcome aboard!".
87
+
9
88
  ## [0.13.1] — 2026-10-20
10
89
 
11
90
  ### Fixed
package/dist/ai-server.js CHANGED
@@ -26,9 +26,9 @@ import {
26
26
  reviewFix,
27
27
  reviewRewrite,
28
28
  reviewSubjects
29
- } from "./chunk-XF25DLD4.js";
30
- import "./chunk-A4KF7NMP.js";
31
- import "./chunk-ZTUW25BG.js";
29
+ } from "./chunk-I6FP6BBI.js";
30
+ import "./chunk-XALUYZYQ.js";
31
+ import "./chunk-RZ3O4MH5.js";
32
32
 
33
33
  // src/ai/agentEndpoint.js
34
34
  var TASKS = ["rewrite", "subjects"];
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cleanRichText
3
- } from "./chunk-UGF3YJ64.js";
3
+ } from "./chunk-6LTSEPQX.js";
4
4
  import {
5
5
  Button,
6
6
  Dialog,
@@ -16,11 +16,12 @@ import {
16
16
  Input,
17
17
  Label,
18
18
  SectionLabel,
19
+ Textarea,
19
20
  cn,
20
21
  createHttpCaller,
21
22
  useUi
22
- } from "./chunk-2IDNT724.js";
23
- import "./chunk-NPE7WFT5.js";
23
+ } from "./chunk-ND3B5TL7.js";
24
+ import "./chunk-6ZX3VYE4.js";
24
25
  import {
25
26
  AGENT_ERROR_CODES,
26
27
  AGENT_PROTOCOL,
@@ -43,9 +44,9 @@ import {
43
44
  providerEmailModel,
44
45
  resolveProvider,
45
46
  visibleText
46
- } from "./chunk-XF25DLD4.js";
47
- import "./chunk-A4KF7NMP.js";
48
- import "./chunk-ZTUW25BG.js";
47
+ } from "./chunk-I6FP6BBI.js";
48
+ import "./chunk-XALUYZYQ.js";
49
+ import "./chunk-RZ3O4MH5.js";
49
50
 
50
51
  // src/ai/keys.js
51
52
  var STORAGE_PREFIX = "best-email-builder:ai-key:";
@@ -935,7 +936,7 @@ import { ChevronDown as ChevronDown2, Languages, Loader2 as Loader22, PenLine, S
935
936
 
936
937
  // src/ai/chip.js
937
938
  var chipClassName = (selected = false) => cn(
938
- "eb:inline-flex eb:h-7 eb:items-center eb:gap-1 eb:rounded-full eb:border eb:px-3 eb:text-[12px] eb:font-medium eb:transition-colors eb:outline-none eb:focus-visible:ring-[3px] eb:focus-visible:ring-ring/50 eb:disabled:opacity-50",
939
+ "eb:inline-flex eb:h-[22px] eb:items-center eb:gap-1 eb:rounded-full eb:border eb:px-2.5 eb:text-[12px] eb:font-medium eb:transition-colors eb:outline-none eb:focus-visible:ring-[3px] eb:focus-visible:ring-ring/50 eb:disabled:opacity-50",
939
940
  selected ? "eb:border-primary eb:bg-primary eb:text-primary-foreground" : "eb:border-border eb:bg-background eb:text-foreground eb:hover:border-primary/50 eb:hover:bg-primary/5"
940
941
  );
941
942
 
@@ -1020,28 +1021,17 @@ function RewriteText({ editor, selection, rewrite }) {
1020
1021
  /* @__PURE__ */ jsx4(PenLine, { className: "eb:size-3", "aria-hidden": "true" }),
1021
1022
  t("Write with AI")
1022
1023
  ] }),
1023
- /* @__PURE__ */ jsxs4(
1024
- "form",
1024
+ /* @__PURE__ */ jsx4(
1025
+ PromptForm,
1025
1026
  {
1026
- className: "eb:flex eb:gap-1.5",
1027
- onSubmit: (event) => {
1028
- event.preventDefault();
1029
- write();
1030
- },
1031
- children: [
1032
- /* @__PURE__ */ jsx4(
1033
- Input,
1034
- {
1035
- value: topic,
1036
- onChange: (event) => setTopic(event.target.value),
1037
- maxLength: MAX_REWRITE_INSTRUCTION,
1038
- placeholder: t("What should it say? e.g. the sale ends Sunday"),
1039
- "aria-label": t("What the text is about"),
1040
- disabled: busy
1041
- }
1042
- ),
1043
- /* @__PURE__ */ jsx4(Button, { type: "submit", variant: "outline", size: "icon-sm", "aria-label": t("Write"), disabled: busy || !topic.trim(), children: running === "write" ? /* @__PURE__ */ jsx4(Loader22, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx4(PenLine, {}) })
1044
- ]
1027
+ value: topic,
1028
+ onChange: setTopic,
1029
+ onSubmit: write,
1030
+ placeholder: t("What should it say? e.g. the sale ends Sunday"),
1031
+ label: t("What the text is about"),
1032
+ busy,
1033
+ submitLabel: t("Write"),
1034
+ children: running === "write" ? /* @__PURE__ */ jsx4(Loader22, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx4(PenLine, {})
1045
1035
  }
1046
1036
  )
1047
1037
  ] }),
@@ -1064,28 +1054,17 @@ function RewriteText({ editor, selection, rewrite }) {
1064
1054
  /* @__PURE__ */ jsx4(DropdownMenuContent, { align: "start", "aria-label": t("Translate into"), children: REWRITE_LANGUAGES.map((code) => /* @__PURE__ */ jsx4(DropdownMenuItem, { lang: code, onSelect: () => run("translate", { targetLanguage: code }), children: nativeName(code) }, code)) })
1065
1055
  ] })
1066
1056
  ] }),
1067
- /* @__PURE__ */ jsxs4(
1068
- "form",
1057
+ /* @__PURE__ */ jsx4(
1058
+ PromptForm,
1069
1059
  {
1070
- className: "eb:flex eb:gap-1.5",
1071
- onSubmit: (event) => {
1072
- event.preventDefault();
1073
- if (instruction.trim()) run("custom", { instruction: instruction.trim() });
1074
- },
1075
- children: [
1076
- /* @__PURE__ */ jsx4(
1077
- Input,
1078
- {
1079
- value: instruction,
1080
- onChange: (event) => setInstruction(event.target.value),
1081
- maxLength: MAX_REWRITE_INSTRUCTION,
1082
- placeholder: t("Or say what to change\u2026"),
1083
- "aria-label": t("What to change"),
1084
- disabled: busy
1085
- }
1086
- ),
1087
- /* @__PURE__ */ jsx4(Button, { type: "submit", variant: "outline", size: "icon-sm", "aria-label": t("Rewrite"), disabled: busy || !instruction.trim(), children: running === "custom" ? /* @__PURE__ */ jsx4(Loader22, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx4(Sparkles, {}) })
1088
- ]
1060
+ value: instruction,
1061
+ onChange: setInstruction,
1062
+ onSubmit: () => run("custom", { instruction: instruction.trim() }),
1063
+ placeholder: t("Or say what to change\u2026"),
1064
+ label: t("What to change"),
1065
+ busy,
1066
+ submitLabel: t("Rewrite"),
1067
+ children: running === "custom" ? /* @__PURE__ */ jsx4(Loader22, { className: "eb:animate-spin" }) : /* @__PURE__ */ jsx4(Sparkles, {})
1089
1068
  }
1090
1069
  ),
1091
1070
  running && /* @__PURE__ */ jsxs4("p", { className: "eb:flex eb:items-center eb:gap-2 eb:text-[12px] eb:text-foreground-muted", role: "status", "aria-live": "polite", children: [
@@ -1099,6 +1078,41 @@ function RewriteText({ editor, selection, rewrite }) {
1099
1078
  ] })
1100
1079
  ] });
1101
1080
  }
1081
+ function PromptForm({ value, onChange, onSubmit, placeholder, label, busy, submitLabel, children }) {
1082
+ const ready = !busy && Boolean(value.trim());
1083
+ return /* @__PURE__ */ jsxs4(
1084
+ "form",
1085
+ {
1086
+ className: "eb:flex eb:items-end eb:gap-1.5",
1087
+ onSubmit: (event) => {
1088
+ event.preventDefault();
1089
+ if (ready) onSubmit();
1090
+ },
1091
+ children: [
1092
+ /* @__PURE__ */ jsx4(
1093
+ Textarea,
1094
+ {
1095
+ dense: true,
1096
+ rows: 3,
1097
+ value,
1098
+ onChange: (event) => onChange(event.target.value),
1099
+ onKeyDown: (event) => {
1100
+ if (event.key !== "Enter" || event.shiftKey || event.nativeEvent.isComposing) return;
1101
+ event.preventDefault();
1102
+ if (ready) onSubmit();
1103
+ },
1104
+ maxLength: MAX_REWRITE_INSTRUCTION,
1105
+ placeholder,
1106
+ "aria-label": label,
1107
+ disabled: busy,
1108
+ className: "eb:min-h-16 eb:max-h-40 eb:resize-none"
1109
+ }
1110
+ ),
1111
+ /* @__PURE__ */ jsx4(Button, { type: "submit", variant: "outline", size: "icon-dense", "aria-label": submitLabel, disabled: !ready, children })
1112
+ ]
1113
+ }
1114
+ );
1115
+ }
1102
1116
 
1103
1117
  // src/ai/SubjectIdeas.jsx
1104
1118
  import { useEffect as useEffect5, useLayoutEffect, useRef as useRef5, useState as useState5 } from "react";