@maildeno/editor 0.4.3 → 0.4.4
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.
- package/CHANGELOG.md +29 -0
- package/dist/RowPreviewChildren-C_6CFAct.js +4 -0
- package/dist/RowPreviewChildren-y7meU9Pj.js +4 -0
- package/dist/RowPreviewLegacyComponent-B1rwsYW_.js +454 -0
- package/dist/RowPreviewLegacyComponent-Dv7OCys4.js +454 -0
- package/dist/RowPreviewRow-BjO2HdFR.js +86 -0
- package/dist/RowPreviewRow-D8yJ4LSs.js +86 -0
- package/dist/babel-Bmz1GpKj.js +7218 -0
- package/dist/editor.css +1 -2810
- package/dist/element-DyFj9kgl.js +62972 -0
- package/dist/element.js +5 -2
- package/dist/estree-C5xyFN_T.js +4831 -0
- package/dist/html-Dc_r73Xn.js +3062 -0
- package/dist/index-Cud9IN-O.js +56306 -0
- package/dist/index.js +15 -68394
- package/dist/init.js +145 -153
- package/dist/standalone-Yv8gSIWN.js +2336 -0
- package/package.json +1 -1
- package/dist/RowPreviewLegacyComponent-BFvLnPiK.js +0 -439
- package/dist/RowPreviewLegacyComponent-CXsY4P-R.js +0 -439
- package/dist/RowPreviewRow-CeowK6Q_.js +0 -107
- package/dist/RowPreviewRow-D-6koDUR.js +0 -107
- package/dist/element-95RHug4F.js +0 -68388
- package/dist/element-scoped-styles.css +0 -2810
- package/dist/estree-B67dfAo1.js +0 -7989
- package/dist/html-D6UnSE1C.js +0 -7353
- package/dist/standalone-Bd2oQFm3.js +0 -3639
- package/dist/typescript-C_Ru9PRN.js +0 -23184
- package/dist/vue.runtime.esm-bundler-BaHqghYy.js +0 -9097
package/dist/init.js
CHANGED
|
@@ -1,156 +1,148 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
stylesInjected = true;
|
|
14
|
-
for (const css of buildShadowStyles()) {
|
|
15
|
-
if (!css) continue;
|
|
16
|
-
const style = document.createElement("style");
|
|
17
|
-
style.setAttribute("data-maildeno-light-dom", "");
|
|
18
|
-
style.textContent = css;
|
|
19
|
-
document.head.appendChild(style);
|
|
20
|
-
}
|
|
1
|
+
import { r as g, c as u, b as f, h as v, _ as S, a as h, d as E } from "./element-DyFj9kgl.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-DyFj9kgl.js";
|
|
3
|
+
let c = !1;
|
|
4
|
+
function p() {
|
|
5
|
+
if (!(c || typeof document > "u")) {
|
|
6
|
+
c = !0;
|
|
7
|
+
for (const e of f()) {
|
|
8
|
+
if (!e) continue;
|
|
9
|
+
const l = document.createElement("style");
|
|
10
|
+
l.setAttribute("data-maildeno-light-dom", ""), l.textContent = e, document.head.appendChild(l);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
21
13
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
app.unmount();
|
|
48
|
-
mountEl.remove();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
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;
|
|
32
|
+
},
|
|
33
|
+
addSaveHandler: (t) => i.add(t),
|
|
34
|
+
removeSaveHandler: (t) => i.delete(t),
|
|
35
|
+
destroy: () => {
|
|
36
|
+
r.unmount(), n.remove();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
51
39
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
async function H(e) {
|
|
41
|
+
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
|
+
);
|
|
46
|
+
if (e.shadowDom === !1) {
|
|
47
|
+
const n = y(l, {
|
|
48
|
+
templateId: e.templateId,
|
|
49
|
+
storageAdapter: e.storageAdapter,
|
|
50
|
+
theme: e.theme,
|
|
51
|
+
capabilities: e.capabilities,
|
|
52
|
+
onSendTestEmail: e.onSendTestEmail,
|
|
53
|
+
brandName: e.brandName,
|
|
54
|
+
versions: e.versions,
|
|
55
|
+
saveHandler: e.onSave,
|
|
56
|
+
assistant: e.assistant
|
|
57
|
+
});
|
|
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;
|
|
63
|
+
};
|
|
64
|
+
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),
|
|
72
|
+
getJson: () => r("getJson"),
|
|
73
|
+
setJson: (t, s) => {
|
|
74
|
+
r("setJson", t, s);
|
|
75
|
+
},
|
|
76
|
+
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) ?? (() => {
|
|
82
|
+
}),
|
|
83
|
+
destroy: () => n.destroy()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
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));
|
|
89
|
+
const i = /* @__PURE__ */ new WeakMap();
|
|
90
|
+
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);
|
|
97
|
+
},
|
|
98
|
+
off(n, r) {
|
|
99
|
+
const t = i.get(r);
|
|
100
|
+
t && (a.removeEventListener(n, t), i.delete(r));
|
|
101
|
+
},
|
|
102
|
+
setTheme(n) {
|
|
103
|
+
a.theme = n;
|
|
104
|
+
},
|
|
105
|
+
getHtml(n = "prune") {
|
|
106
|
+
return a.getHtml ? a.getHtml(n) : null;
|
|
107
|
+
},
|
|
108
|
+
getMjml(n = "prune") {
|
|
109
|
+
return a.getMjml ? a.getMjml(n) : null;
|
|
110
|
+
},
|
|
111
|
+
getReactEmail(n = "prune") {
|
|
112
|
+
return a.getReactEmail ? a.getReactEmail(n) : null;
|
|
113
|
+
},
|
|
114
|
+
getJson() {
|
|
115
|
+
return a.getJson ? a.getJson() : null;
|
|
116
|
+
},
|
|
117
|
+
setJson(n, r) {
|
|
118
|
+
var t;
|
|
119
|
+
(t = a.setJson) == null || t.call(a, n, r);
|
|
120
|
+
},
|
|
121
|
+
getSelection() {
|
|
122
|
+
return a.getSelection ? a.getSelection() : null;
|
|
123
|
+
},
|
|
124
|
+
setSelection(n) {
|
|
125
|
+
return a.setSelection ? a.setSelection(n) : !1;
|
|
126
|
+
},
|
|
127
|
+
onChange(n) {
|
|
128
|
+
return a.onChange ? a.onChange(n) : () => {
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
destroy() {
|
|
132
|
+
a.remove();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
56
135
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
assistant: options.assistant
|
|
71
|
-
});
|
|
72
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
73
|
-
const call = (name, ...args) => {
|
|
74
|
-
const fn = mount.exposed()?.[name];
|
|
75
|
-
return typeof fn === "function" ? fn(...args) : null;
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
element: mount.element,
|
|
79
|
-
on: (_event, handler) => mount.addSaveHandler(handler),
|
|
80
|
-
off: (_event, handler) => mount.removeSaveHandler(handler),
|
|
81
|
-
setTheme: (theme) => mount.setProp("theme", theme),
|
|
82
|
-
getHtml: (mode = "prune") => call("getHtml", mode),
|
|
83
|
-
getMjml: (mode = "prune") => call("getMjml", mode),
|
|
84
|
-
getReactEmail: (mode = "prune") => call("getReactEmail", mode),
|
|
85
|
-
getJson: () => call("getJson"),
|
|
86
|
-
setJson: (data, opts) => {
|
|
87
|
-
call("setJson", data, opts);
|
|
88
|
-
},
|
|
89
|
-
getSelection: () => call("getSelection"),
|
|
90
|
-
setSelection: (id) => call("setSelection", id) ?? false,
|
|
91
|
-
onChange: (cb) => call("onChange", cb) ?? (() => {}),
|
|
92
|
-
destroy: () => mount.destroy()
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
registerMaildenoEditorElement();
|
|
96
|
-
const el = document.createElement("maildeno-editor");
|
|
97
|
-
if (options.templateId !== void 0) el.templateId = options.templateId;
|
|
98
|
-
if (options.storageAdapter) el.storageAdapter = options.storageAdapter;
|
|
99
|
-
if (options.theme) el.theme = options.theme;
|
|
100
|
-
if (options.capabilities) el.capabilities = options.capabilities;
|
|
101
|
-
if (options.onSendTestEmail) el.onSendTestEmail = options.onSendTestEmail;
|
|
102
|
-
if (options.brandName !== void 0) el.brandName = options.brandName;
|
|
103
|
-
if (options.versions !== void 0) el.versions = options.versions;
|
|
104
|
-
if (options.assistant) el.assistant = options.assistant;
|
|
105
|
-
if (options.onSave) el.saveHandler = options.onSave;
|
|
106
|
-
container.appendChild(el);
|
|
107
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
108
|
-
const listenerWrappers = /* @__PURE__ */ new WeakMap();
|
|
109
|
-
return {
|
|
110
|
-
element: el,
|
|
111
|
-
on(event, handler) {
|
|
112
|
-
const wrapped = ((e) => handler(Array.isArray(e.detail) ? e.detail[0] : e.detail));
|
|
113
|
-
listenerWrappers.set(handler, wrapped);
|
|
114
|
-
el.addEventListener(toDomEventName(event), wrapped);
|
|
115
|
-
},
|
|
116
|
-
off(event, handler) {
|
|
117
|
-
const wrapped = listenerWrappers.get(handler);
|
|
118
|
-
if (wrapped) {
|
|
119
|
-
el.removeEventListener(toDomEventName(event), wrapped);
|
|
120
|
-
listenerWrappers.delete(handler);
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
setTheme(theme) {
|
|
124
|
-
el.theme = theme;
|
|
125
|
-
},
|
|
126
|
-
getHtml(mode = "prune") {
|
|
127
|
-
return el.getHtml ? el.getHtml(mode) : null;
|
|
128
|
-
},
|
|
129
|
-
getMjml(mode = "prune") {
|
|
130
|
-
return el.getMjml ? el.getMjml(mode) : null;
|
|
131
|
-
},
|
|
132
|
-
getReactEmail(mode = "prune") {
|
|
133
|
-
return el.getReactEmail ? el.getReactEmail(mode) : null;
|
|
134
|
-
},
|
|
135
|
-
getJson() {
|
|
136
|
-
return el.getJson ? el.getJson() : null;
|
|
137
|
-
},
|
|
138
|
-
setJson(data, opts) {
|
|
139
|
-
el.setJson?.(data, opts);
|
|
140
|
-
},
|
|
141
|
-
getSelection() {
|
|
142
|
-
return el.getSelection ? el.getSelection() : null;
|
|
143
|
-
},
|
|
144
|
-
setSelection(id) {
|
|
145
|
-
return el.setSelection ? el.setSelection(id) : false;
|
|
146
|
-
},
|
|
147
|
-
onChange(cb) {
|
|
148
|
-
return el.onChange ? el.onChange(cb) : () => {};
|
|
149
|
-
},
|
|
150
|
-
destroy() {
|
|
151
|
-
el.remove();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
//#endregion
|
|
156
|
-
export { createLocalStorageAdapter, getAllBlocks, getBlock, getRegisteredCustomESPs, getRegisteredMergeTagIds, init, palette, registerBlock, registerESPSyntax, registerMergeTags, setEditorTheme };
|
|
136
|
+
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
|
|
148
|
+
};
|