@maildeno/editor 0.4.6 → 0.4.7

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 (61) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/DatePicker-DIaGGAVI.js +5347 -0
  3. package/dist/DatePicker-DmMga5gQ.js +5347 -0
  4. package/dist/Dialog-GTfGtduh.js +6294 -0
  5. package/dist/HealthIndicator--ScSxVRA.js +1216 -0
  6. package/dist/HealthIndicator-BraAh2Aj.js +1217 -0
  7. package/dist/Icon-BYmOM482.js +2537 -0
  8. package/dist/Icon-c2SPT3-6.js +2577 -0
  9. package/dist/PreviewCanvas-C1-rP9-B.js +533 -0
  10. package/dist/PreviewCanvas-Nro7tNCn.js +533 -0
  11. package/dist/RichTextEditor-CrYhiAOo.js +12217 -0
  12. package/dist/RichTextEditor-D7Itx0fL.js +12218 -0
  13. package/dist/RowPreviewChildren-B66HbFdX.js +4 -0
  14. package/dist/RowPreviewChildren-DvrE9HTT.js +4 -0
  15. package/dist/RowPreviewLegacyComponent-3QuwvWmT.js +402 -0
  16. package/dist/RowPreviewLegacyComponent-CPqaWwsE.js +402 -0
  17. package/dist/RowPreviewRow-B91YPfoz.js +80 -0
  18. package/dist/RowPreviewRow-MaA-9ApX.js +80 -0
  19. package/dist/SavedRowsPanel-CF-7R3q_.js +492 -0
  20. package/dist/SavedRowsPanel-TLOEvs3Z.js +491 -0
  21. package/dist/_plugin-vue_export-helper-Dj7HTbfw.js +8 -0
  22. package/dist/babel-DV7WPQI0.js +10043 -0
  23. package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +3 -3
  24. package/dist/composables/emailBuilder/transform/pipeline/optimize.d.ts +4 -4
  25. package/dist/editor.css +2 -1
  26. package/dist/element-CeRQDEn3.js +21396 -0
  27. package/dist/element.js +2 -2
  28. package/dist/estree-DY9POgc0.js +8195 -0
  29. package/dist/html-wb0gSX1o.js +7273 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +14886 -14
  32. package/dist/init.js +83 -94
  33. package/dist/mergeTagDefinitions-Cler19nv.js +27 -0
  34. package/dist/standalone-DHvJ30Td.js +3554 -0
  35. package/dist/useEmailBuilder-CjJoxzTi.js +4893 -0
  36. package/dist/useEmailBuilder-gOc8otd8.js +4893 -0
  37. package/dist/useToast-DeNMwkP3.js +194 -0
  38. package/dist/vue.runtime.esm-bundler-D2AjRP90.js +6117 -0
  39. package/package.json +3 -1
  40. package/dist/DatePicker-6dMK-shv.js +0 -5639
  41. package/dist/DatePicker-CEm1DPgG.js +0 -5640
  42. package/dist/HealthIndicator-Ch5Ck0BL.js +0 -1954
  43. package/dist/HealthIndicator-Dr5vMr1T.js +0 -1953
  44. package/dist/PreviewCanvas-CG52GC5m.js +0 -667
  45. package/dist/PreviewCanvas-CjOrVIGt.js +0 -668
  46. package/dist/RichTextEditor-DaaHuVox.js +0 -13487
  47. package/dist/RichTextEditor-DoWpYF0R.js +0 -13432
  48. package/dist/RowPreviewChildren-DQoyExvw.js +0 -4
  49. package/dist/RowPreviewChildren-yl3aB7hb.js +0 -4
  50. package/dist/RowPreviewLegacyComponent-CHxbwy9l.js +0 -454
  51. package/dist/RowPreviewLegacyComponent-Dv7OCys4.js +0 -454
  52. package/dist/RowPreviewRow-Bizr4PTf.js +0 -86
  53. package/dist/RowPreviewRow-CLhz0YQ5.js +0 -86
  54. package/dist/SavedRowsPanel-C0DkAzHi.js +0 -611
  55. package/dist/SavedRowsPanel-Cp3gADrK.js +0 -610
  56. package/dist/babel-Bmz1GpKj.js +0 -7218
  57. package/dist/element-CRfWpZos.js +0 -40842
  58. package/dist/estree-C5xyFN_T.js +0 -4831
  59. package/dist/html-Dc_r73Xn.js +0 -3062
  60. package/dist/index-BlYp4vAp.js +0 -34092
  61. package/dist/standalone-Yv8gSIWN.js +0 -2336
package/dist/init.js CHANGED
@@ -1,9 +1,10 @@
1
- import { r as g, c as u, b as f, h as v, _ as S, a as h, d as E } from "./element-CRfWpZos.js";
2
- import { e as A, g as C, f as J, i as M, j, p as I, k as R, l as x, m as N, s as P } from "./element-CRfWpZos.js";
3
- let c = !1;
4
- function p() {
5
- if (!(c || typeof document > "u")) {
6
- c = !0;
1
+ import { O as o, at as c, i as u, st as g } from "./vue.runtime.esm-bundler-D2AjRP90.js";
2
+ import { G as f, a as w, i as H, n as v, r as S } from "./element-CeRQDEn3.js";
3
+ import { E as b, T as A, U as C, c as J, l as M, m as I, p as R, w as j } from "./useEmailBuilder-gOc8otd8.js";
4
+ var m = !1;
5
+ function h() {
6
+ if (!(m || typeof document > "u")) {
7
+ m = !0;
7
8
  for (const e of f()) {
8
9
  if (!e) continue;
9
10
  const l = document.createElement("style");
@@ -11,40 +12,35 @@ function p() {
11
12
  }
12
13
  }
13
14
  }
14
- function y(e, l) {
15
- p();
16
- const a = g({ ...l }), i = /* @__PURE__ */ new Set(), d = h(null), n = document.createElement("div");
17
- n.style.height = "100%", e.appendChild(n);
18
- const r = u({
19
- setup() {
20
- return () => v(S, {
21
- ...a,
22
- ref: d,
23
- onSave: (t) => i.forEach((s) => s(t))
24
- });
25
- }
26
- });
27
- return r.mount(n), {
28
- element: n,
29
- exposed: () => d.value ?? null,
30
- setProp: (t, s) => {
31
- a[t] = s;
15
+ function E(e, l) {
16
+ h();
17
+ const t = c({ ...l }), i = /* @__PURE__ */ new Set(), a = g(null), r = document.createElement("div");
18
+ r.style.height = "100%", e.appendChild(r);
19
+ const n = u({ setup() {
20
+ return () => o(S, {
21
+ ...t,
22
+ ref: a,
23
+ onSave: (s) => i.forEach((d) => d(s))
24
+ });
25
+ } });
26
+ return n.mount(r), {
27
+ element: r,
28
+ exposed: () => a.value ?? null,
29
+ setProp: (s, d) => {
30
+ t[s] = d;
32
31
  },
33
- addSaveHandler: (t) => i.add(t),
34
- removeSaveHandler: (t) => i.delete(t),
32
+ addSaveHandler: (s) => i.add(s),
33
+ removeSaveHandler: (s) => i.delete(s),
35
34
  destroy: () => {
36
- r.unmount(), n.remove();
35
+ n.unmount(), r.remove();
37
36
  }
38
37
  };
39
38
  }
40
- async function H(e) {
39
+ async function N(e) {
41
40
  const l = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
42
- if (!l)
43
- throw new Error(
44
- `[maildeno-editor] init() couldn't find a container${typeof e.container == "string" ? ` matching "${e.container}"` : ""}.`
45
- );
41
+ if (!l) throw new Error(`[maildeno-editor] init() couldn't find a container${typeof e.container == "string" ? ` matching "${e.container}"` : ""}.`);
46
42
  if (e.shadowDom === !1) {
47
- const n = y(l, {
43
+ const a = E(l, {
48
44
  templateId: e.templateId,
49
45
  storageAdapter: e.storageAdapter,
50
46
  theme: e.theme,
@@ -55,94 +51,87 @@ async function H(e) {
55
51
  saveHandler: e.onSave,
56
52
  assistant: e.assistant
57
53
  });
58
- await new Promise((t) => setTimeout(t, 0));
59
- const r = (t, ...s) => {
60
- var m;
61
- const o = (m = n.exposed()) == null ? void 0 : m[t];
62
- return typeof o == "function" ? o(...s) : null;
54
+ await new Promise((n) => setTimeout(n, 0));
55
+ const r = (n, ...s) => {
56
+ const d = a.exposed()?.[n];
57
+ return typeof d == "function" ? d(...s) : null;
63
58
  };
64
59
  return {
65
- element: n.element,
66
- on: (t, s) => n.addSaveHandler(s),
67
- off: (t, s) => n.removeSaveHandler(s),
68
- setTheme: (t) => n.setProp("theme", t),
69
- getHtml: (t = "prune") => r("getHtml", t),
70
- getMjml: (t = "prune") => r("getMjml", t),
71
- getReactEmail: (t = "prune") => r("getReactEmail", t),
60
+ element: a.element,
61
+ on: (n, s) => a.addSaveHandler(s),
62
+ off: (n, s) => a.removeSaveHandler(s),
63
+ setTheme: (n) => a.setProp("theme", n),
64
+ getHtml: (n = "prune") => r("getHtml", n),
65
+ getMjml: (n = "prune") => r("getMjml", n),
66
+ getReactEmail: (n = "prune") => r("getReactEmail", n),
72
67
  getJson: () => r("getJson"),
73
- setJson: (t, s) => {
74
- r("setJson", t, s);
68
+ setJson: (n, s) => {
69
+ r("setJson", n, s);
75
70
  },
76
71
  getSelection: () => r("getSelection"),
77
- setSelection: (t) => r("setSelection", t) ?? !1,
78
- // Falls back to a no-op unsubscribe rather than null so callers can
79
- // always call the result — a host storing it and invoking it during
80
- // teardown shouldn't have to null-check a cleanup function.
81
- onChange: (t) => r("onChange", t) ?? (() => {
72
+ setSelection: (n) => r("setSelection", n) ?? !1,
73
+ onChange: (n) => r("onChange", n) ?? (() => {
82
74
  }),
83
- destroy: () => n.destroy()
75
+ destroy: () => a.destroy()
84
76
  };
85
77
  }
86
- E();
87
- const a = document.createElement("maildeno-editor");
88
- e.templateId !== void 0 && (a.templateId = e.templateId), e.storageAdapter && (a.storageAdapter = e.storageAdapter), e.theme && (a.theme = e.theme), e.capabilities && (a.capabilities = e.capabilities), e.onSendTestEmail && (a.onSendTestEmail = e.onSendTestEmail), e.brandName !== void 0 && (a.brandName = e.brandName), e.versions !== void 0 && (a.versions = e.versions), e.assistant && (a.assistant = e.assistant), e.onSave && (a.saveHandler = e.onSave), l.appendChild(a), await new Promise((n) => setTimeout(n, 0));
78
+ v();
79
+ const t = document.createElement("maildeno-editor");
80
+ e.templateId !== void 0 && (t.templateId = e.templateId), e.storageAdapter && (t.storageAdapter = e.storageAdapter), e.theme && (t.theme = e.theme), e.capabilities && (t.capabilities = e.capabilities), e.onSendTestEmail && (t.onSendTestEmail = e.onSendTestEmail), e.brandName !== void 0 && (t.brandName = e.brandName), e.versions !== void 0 && (t.versions = e.versions), e.assistant && (t.assistant = e.assistant), e.onSave && (t.saveHandler = e.onSave), l.appendChild(t), await new Promise((a) => setTimeout(a, 0));
89
81
  const i = /* @__PURE__ */ new WeakMap();
90
82
  return {
91
- element: a,
92
- on(n, r) {
93
- const t = ((s) => r(
94
- Array.isArray(s.detail) ? s.detail[0] : s.detail
95
- ));
96
- i.set(r, t), a.addEventListener(n, t);
83
+ element: t,
84
+ on(a, r) {
85
+ const n = ((s) => r(Array.isArray(s.detail) ? s.detail[0] : s.detail));
86
+ i.set(r, n), t.addEventListener(a, n);
97
87
  },
98
- off(n, r) {
99
- const t = i.get(r);
100
- t && (a.removeEventListener(n, t), i.delete(r));
88
+ off(a, r) {
89
+ const n = i.get(r);
90
+ n && (t.removeEventListener(a, n), i.delete(r));
101
91
  },
102
- setTheme(n) {
103
- a.theme = n;
92
+ setTheme(a) {
93
+ t.theme = a;
104
94
  },
105
- getHtml(n = "prune") {
106
- return a.getHtml ? a.getHtml(n) : null;
95
+ getHtml(a = "prune") {
96
+ return t.getHtml ? t.getHtml(a) : null;
107
97
  },
108
- getMjml(n = "prune") {
109
- return a.getMjml ? a.getMjml(n) : null;
98
+ getMjml(a = "prune") {
99
+ return t.getMjml ? t.getMjml(a) : null;
110
100
  },
111
- getReactEmail(n = "prune") {
112
- return a.getReactEmail ? a.getReactEmail(n) : null;
101
+ getReactEmail(a = "prune") {
102
+ return t.getReactEmail ? t.getReactEmail(a) : null;
113
103
  },
114
104
  getJson() {
115
- return a.getJson ? a.getJson() : null;
105
+ return t.getJson ? t.getJson() : null;
116
106
  },
117
- setJson(n, r) {
118
- var t;
119
- (t = a.setJson) == null || t.call(a, n, r);
107
+ setJson(a, r) {
108
+ t.setJson?.(a, r);
120
109
  },
121
110
  getSelection() {
122
- return a.getSelection ? a.getSelection() : null;
111
+ return t.getSelection ? t.getSelection() : null;
123
112
  },
124
- setSelection(n) {
125
- return a.setSelection ? a.setSelection(n) : !1;
113
+ setSelection(a) {
114
+ return t.setSelection ? t.setSelection(a) : !1;
126
115
  },
127
- onChange(n) {
128
- return a.onChange ? a.onChange(n) : () => {
116
+ onChange(a) {
117
+ return t.onChange ? t.onChange(a) : () => {
129
118
  };
130
119
  },
131
120
  destroy() {
132
- a.remove();
121
+ t.remove();
133
122
  }
134
123
  };
135
124
  }
136
125
  export {
137
- A as createLocalStorageAdapter,
138
- C as getAllBlocks,
139
- J as getBlock,
140
- M as getRegisteredCustomESPs,
141
- j as getRegisteredMergeTagIds,
142
- H as init,
143
- I as palette,
144
- R as registerBlock,
145
- x as registerESPSyntax,
146
- N as registerMergeTags,
147
- P as setEditorTheme
126
+ C as createLocalStorageAdapter,
127
+ j as getAllBlocks,
128
+ A as getBlock,
129
+ J as getRegisteredCustomESPs,
130
+ R as getRegisteredMergeTagIds,
131
+ N as init,
132
+ H as palette,
133
+ b as registerBlock,
134
+ M as registerESPSyntax,
135
+ I as registerMergeTags,
136
+ w as setEditorTheme
148
137
  };
@@ -0,0 +1,27 @@
1
+ var r = /\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, c = (e) => ({
2
+ name: (e[1] ?? e[2] ?? e[3] ?? "").trim(),
3
+ fallback: (e[4] ?? e[5] ?? e[6] ?? "").trim()
4
+ }), o = (e) => {
5
+ const a = /* @__PURE__ */ new Set();
6
+ r.lastIndex = 0;
7
+ let t;
8
+ for (; (t = r.exec(e)) !== null; ) a.add(c(t).name);
9
+ return [...a];
10
+ }, d = (e) => {
11
+ const a = /* @__PURE__ */ new Map();
12
+ r.lastIndex = 0;
13
+ let t;
14
+ for (; (t = r.exec(e)) !== null; ) {
15
+ const { name: n, fallback: s } = c(t);
16
+ a.has(n) || a.set(n, s);
17
+ }
18
+ return a;
19
+ }, v = (e, a, t) => !t || !e ? e ?? "" : (r.lastIndex = 0, e.replace(r, (n, ...s) => {
20
+ const i = [n, ...s], { name: u, fallback: f } = c(i), l = a[u];
21
+ return l !== void 0 && l !== "" ? l : f || `{{ ${u} }}`;
22
+ }));
23
+ export {
24
+ d as n,
25
+ v as r,
26
+ o as t
27
+ };