@emabuild/core 0.0.9 → 0.1.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.
- package/dist/canvas/content-renderer.d.ts.map +1 -1
- package/dist/canvas/row-renderer.d.ts.map +1 -1
- package/dist/{form-tool-CxJstLJz.js → form-tool-DSXsWpjQ.js} +2 -2
- package/dist/{form-tool-CxJstLJz.js.map → form-tool-DSXsWpjQ.js.map} +1 -1
- package/dist/{html-tool-Cqvglh05.js → html-tool-Be4HAhoj.js} +2 -2
- package/dist/{html-tool-Cqvglh05.js.map → html-tool-Be4HAhoj.js.map} +1 -1
- package/dist/{index-DV_tofKb.js → index-CZt184D3.js} +720 -654
- package/dist/index-CZt184D3.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{menu-tool-ACBHeTTN.js → menu-tool-HPxxeiRV.js} +2 -2
- package/dist/{menu-tool-ACBHeTTN.js.map → menu-tool-HPxxeiRV.js.map} +1 -1
- package/dist/{social-tool-MqaqWdRm.js → social-tool-bc46FNgk.js} +2 -2
- package/dist/{social-tool-MqaqWdRm.js.map → social-tool-bc46FNgk.js.map} +1 -1
- package/dist/{table-tool-AnVvJ0rV.js → table-tool-LzRcAPFb.js} +2 -2
- package/dist/{table-tool-AnVvJ0rV.js.map → table-tool-LzRcAPFb.js.map} +1 -1
- package/dist/{timer-tool-BxrGmF-W.js → timer-tool-GPhdsvRE.js} +2 -2
- package/dist/{timer-tool-BxrGmF-W.js.map → timer-tool-GPhdsvRE.js.map} +1 -1
- package/dist/tools/built-in/image-tool.d.ts.map +1 -1
- package/dist/tools/helpers/index.d.ts +1 -1
- package/dist/tools/helpers/index.d.ts.map +1 -1
- package/dist/tools/helpers/value-extractor.d.ts +35 -0
- package/dist/tools/helpers/value-extractor.d.ts.map +1 -1
- package/dist/{video-tool-8g1_UVbn.js → video-tool-CPjCWbTX.js} +2 -2
- package/dist/{video-tool-8g1_UVbn.js.map → video-tool-CPjCWbTX.js.map} +1 -1
- package/package.json +3 -3
- package/dist/index-DV_tofKb.js.map +0 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { html as c, LitElement as
|
|
2
|
-
import { property as
|
|
1
|
+
import { html as c, LitElement as v, css as $ } from "lit";
|
|
2
|
+
import { property as f, customElement as k } from "lit/decorators.js";
|
|
3
3
|
import { unsafeHTML as q } from "lit/directives/unsafe-html.js";
|
|
4
|
-
function
|
|
5
|
-
const
|
|
4
|
+
function lt() {
|
|
5
|
+
const t = {};
|
|
6
6
|
return {
|
|
7
7
|
getCounters() {
|
|
8
|
-
return { ...
|
|
8
|
+
return { ...t };
|
|
9
9
|
},
|
|
10
|
-
setCounters(
|
|
11
|
-
for (const o of Object.keys(
|
|
12
|
-
delete
|
|
13
|
-
Object.assign(
|
|
10
|
+
setCounters(e) {
|
|
11
|
+
for (const o of Object.keys(t))
|
|
12
|
+
delete t[o];
|
|
13
|
+
Object.assign(t, e);
|
|
14
14
|
},
|
|
15
|
-
next(
|
|
16
|
-
const o = e
|
|
17
|
-
return e
|
|
15
|
+
next(e) {
|
|
16
|
+
const o = t[e] ?? 0;
|
|
17
|
+
return t[e] = o + 1, t[e];
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class dt {
|
|
22
22
|
constructor() {
|
|
23
23
|
this.listeners = /* @__PURE__ */ new Map();
|
|
24
24
|
}
|
|
25
25
|
/** Register a listener for an event */
|
|
26
|
-
on(
|
|
27
|
-
this.listeners.has(
|
|
26
|
+
on(e, o) {
|
|
27
|
+
this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(o);
|
|
28
28
|
}
|
|
29
29
|
/** Remove a specific listener */
|
|
30
|
-
off(
|
|
31
|
-
this.listeners.get(
|
|
30
|
+
off(e, o) {
|
|
31
|
+
this.listeners.get(e)?.delete(o);
|
|
32
32
|
}
|
|
33
33
|
/** Emit an event with a payload. Errors in listeners are caught and logged. */
|
|
34
|
-
emit(
|
|
35
|
-
this.listeners.get(
|
|
34
|
+
emit(e, o) {
|
|
35
|
+
this.listeners.get(e)?.forEach((n) => {
|
|
36
36
|
try {
|
|
37
37
|
n(o);
|
|
38
38
|
} catch (i) {
|
|
39
|
-
console.error(`[emabuild] Error in "${
|
|
39
|
+
console.error(`[emabuild] Error in "${e}" listener:`, i);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
/** Remove all listeners, optionally scoped to a single event */
|
|
44
|
-
removeAllListeners(
|
|
45
|
-
|
|
44
|
+
removeAllListeners(e) {
|
|
45
|
+
e ? this.listeners.delete(e) : this.listeners.clear();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
class
|
|
49
|
-
constructor(
|
|
50
|
-
this.undoStack = [], this.redoStack = [], this.maxHistory =
|
|
48
|
+
class ct {
|
|
49
|
+
constructor(e = 50) {
|
|
50
|
+
this.undoStack = [], this.redoStack = [], this.maxHistory = e;
|
|
51
51
|
}
|
|
52
52
|
/** Whether there are states to undo to */
|
|
53
53
|
get canUndo() {
|
|
@@ -58,27 +58,27 @@ class lt {
|
|
|
58
58
|
return this.redoStack.length > 0;
|
|
59
59
|
}
|
|
60
60
|
/** Save current design to the undo stack before a mutation */
|
|
61
|
-
push(
|
|
62
|
-
this.undoStack.push(structuredClone(
|
|
61
|
+
push(e) {
|
|
62
|
+
this.undoStack.push(structuredClone(e)), this.undoStack.length > this.maxHistory && this.undoStack.shift(), this.redoStack = [];
|
|
63
63
|
}
|
|
64
64
|
/** Restore the previous state, pushing current state to redo. Returns the restored design or undefined. */
|
|
65
|
-
undo(
|
|
65
|
+
undo(e) {
|
|
66
66
|
const o = this.undoStack.pop();
|
|
67
67
|
if (o)
|
|
68
|
-
return this.redoStack.push(structuredClone(
|
|
68
|
+
return this.redoStack.push(structuredClone(e)), o;
|
|
69
69
|
}
|
|
70
70
|
/** Restore the next state, pushing current state to undo. Returns the restored design or undefined. */
|
|
71
|
-
redo(
|
|
71
|
+
redo(e) {
|
|
72
72
|
const o = this.redoStack.pop();
|
|
73
73
|
if (o)
|
|
74
|
-
return this.undoStack.push(structuredClone(
|
|
74
|
+
return this.undoStack.push(structuredClone(e)), o;
|
|
75
75
|
}
|
|
76
76
|
/** Clear all history (e.g. when loading a new design) */
|
|
77
77
|
clear() {
|
|
78
78
|
this.undoStack = [], this.redoStack = [];
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function pt() {
|
|
82
82
|
return {
|
|
83
83
|
counters: { u_row: 0, u_column: 0 },
|
|
84
84
|
body: {
|
|
@@ -123,9 +123,9 @@ function at() {
|
|
|
123
123
|
schemaVersion: 16
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const o =
|
|
128
|
-
const i =
|
|
126
|
+
function ht(t, e) {
|
|
127
|
+
const o = t.next("u_row"), n = e.map(() => {
|
|
128
|
+
const i = t.next("u_column");
|
|
129
129
|
return {
|
|
130
130
|
id: `u_column_${i}`,
|
|
131
131
|
contents: [],
|
|
@@ -140,7 +140,7 @@ function dt(e, t) {
|
|
|
140
140
|
});
|
|
141
141
|
return {
|
|
142
142
|
id: `u_row_${o}`,
|
|
143
|
-
cells:
|
|
143
|
+
cells: e,
|
|
144
144
|
columns: n,
|
|
145
145
|
values: {
|
|
146
146
|
displayCondition: null,
|
|
@@ -156,58 +156,58 @@ function dt(e, t) {
|
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
const n =
|
|
159
|
+
function ut(t, e, o = {}) {
|
|
160
|
+
const n = t.next(`u_content_${e}`), i = `u_content_${e}_${n}`;
|
|
161
161
|
return {
|
|
162
162
|
id: i,
|
|
163
|
-
type:
|
|
163
|
+
type: e,
|
|
164
164
|
values: {
|
|
165
165
|
containerPadding: "10px",
|
|
166
166
|
anchor: "",
|
|
167
167
|
hideDesktop: !1,
|
|
168
168
|
hideMobile: !1,
|
|
169
169
|
displayCondition: null,
|
|
170
|
-
_meta: { htmlID: i, htmlClassNames: `u_content_${
|
|
170
|
+
_meta: { htmlID: i, htmlClassNames: `u_content_${e}` },
|
|
171
171
|
...o
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
function U(
|
|
176
|
-
return
|
|
175
|
+
function U(t, e) {
|
|
176
|
+
return t.body.rows.find((o) => o.id === e);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
for (const o of
|
|
180
|
-
const n = o.columns.find((i) => i.id ===
|
|
178
|
+
function H(t, e) {
|
|
179
|
+
for (const o of t.body.rows) {
|
|
180
|
+
const n = o.columns.find((i) => i.id === e);
|
|
181
181
|
if (n) return n;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
for (const o of
|
|
184
|
+
function O(t, e) {
|
|
185
|
+
for (const o of t.body.rows)
|
|
186
186
|
for (const n of o.columns) {
|
|
187
|
-
const i = n.contents.find((r) => r.id ===
|
|
187
|
+
const i = n.contents.find((r) => r.id === e);
|
|
188
188
|
if (i) return i;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
for (const o of
|
|
191
|
+
function gt(t, e) {
|
|
192
|
+
for (const o of t.body.rows)
|
|
193
193
|
for (const n of o.columns)
|
|
194
|
-
if (n.contents.some((i) => i.id ===
|
|
194
|
+
if (n.contents.some((i) => i.id === e)) return n;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
for (const o of
|
|
198
|
-
if (o.columns.some((n) => n.id ===
|
|
196
|
+
function bt(t, e) {
|
|
197
|
+
for (const o of t.body.rows)
|
|
198
|
+
if (o.columns.some((n) => n.id === e)) return o;
|
|
199
199
|
}
|
|
200
|
-
function F(
|
|
201
|
-
return
|
|
200
|
+
function F(t, e) {
|
|
201
|
+
return t.body.rows.findIndex((o) => o.id === e);
|
|
202
202
|
}
|
|
203
|
-
class
|
|
203
|
+
class ft {
|
|
204
204
|
constructor() {
|
|
205
|
-
this.history = new
|
|
205
|
+
this.history = new ct(), this.counterManager = lt(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new dt(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = pt();
|
|
206
206
|
}
|
|
207
207
|
// ── Subscriptions ──────────────────────────────────────────
|
|
208
208
|
/** Subscribe to ALL state changes (legacy). Returns an unsubscribe function. */
|
|
209
|
-
subscribe(
|
|
210
|
-
return this.subscribers.add(
|
|
209
|
+
subscribe(e) {
|
|
210
|
+
return this.subscribers.add(e), () => this.subscribers.delete(e);
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* Subscribe to specific channels only. The callback is invoked only
|
|
@@ -219,23 +219,23 @@ class ut {
|
|
|
219
219
|
* store.subscribeChannels(['design'], () => this.requestUpdate());
|
|
220
220
|
* ```
|
|
221
221
|
*/
|
|
222
|
-
subscribeChannels(
|
|
223
|
-
for (const n of
|
|
222
|
+
subscribeChannels(e, o) {
|
|
223
|
+
for (const n of e)
|
|
224
224
|
this.channelSubscribers.has(n) || this.channelSubscribers.set(n, /* @__PURE__ */ new Set()), this.channelSubscribers.get(n).add(o);
|
|
225
225
|
return () => {
|
|
226
|
-
for (const n of
|
|
226
|
+
for (const n of e)
|
|
227
227
|
this.channelSubscribers.get(n)?.delete(o);
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
/** Notify legacy (all) subscribers */
|
|
231
231
|
notify() {
|
|
232
|
-
this.subscribers.forEach((
|
|
232
|
+
this.subscribers.forEach((e) => e());
|
|
233
233
|
}
|
|
234
234
|
/** Notify only subscribers of specific channels + legacy subscribers */
|
|
235
|
-
notifyChannels(...
|
|
235
|
+
notifyChannels(...e) {
|
|
236
236
|
const o = /* @__PURE__ */ new Set();
|
|
237
237
|
for (const n of this.subscribers) o.add(n);
|
|
238
|
-
for (const n of
|
|
238
|
+
for (const n of e) {
|
|
239
239
|
const i = this.channelSubscribers.get(n);
|
|
240
240
|
if (i) for (const r of i) o.add(r);
|
|
241
241
|
}
|
|
@@ -278,185 +278,185 @@ class ut {
|
|
|
278
278
|
}
|
|
279
279
|
// ── Design Loading ─────────────────────────────────────────
|
|
280
280
|
/** Load a design document, resetting history and selection */
|
|
281
|
-
loadDesign(
|
|
282
|
-
this.design = structuredClone(
|
|
281
|
+
loadDesign(e) {
|
|
282
|
+
this.design = structuredClone(e), this.counterManager.setCounters(this.design.counters), this.history.clear(), this._selectedId = null, this.notifyChannels("design", "selection"), this.events.emit("design:loaded", { design: this.design });
|
|
283
283
|
}
|
|
284
284
|
// ── Undo / Redo ────────────────────────────────────────────
|
|
285
285
|
undo() {
|
|
286
|
-
const
|
|
287
|
-
|
|
286
|
+
const e = this.history.undo(this.design);
|
|
287
|
+
e && (this.design = e, this.counterManager.setCounters(this.design.counters), this.notifyChannels("design"), this.emitUpdate("content_updated"));
|
|
288
288
|
}
|
|
289
289
|
redo() {
|
|
290
|
-
const
|
|
291
|
-
|
|
290
|
+
const e = this.history.redo(this.design);
|
|
291
|
+
e && (this.design = e, this.counterManager.setCounters(this.design.counters), this.notifyChannels("design"), this.emitUpdate("content_updated"));
|
|
292
292
|
}
|
|
293
293
|
// ── Selection / UI State ───────────────────────────────────
|
|
294
|
-
select(
|
|
295
|
-
this._selectedId =
|
|
294
|
+
select(e) {
|
|
295
|
+
this._selectedId = e, this.notifyChannels("selection");
|
|
296
296
|
}
|
|
297
|
-
hover(
|
|
298
|
-
this._hoveredId =
|
|
297
|
+
hover(e) {
|
|
298
|
+
this._hoveredId = e, this.notifyChannels("hover");
|
|
299
299
|
}
|
|
300
|
-
setViewMode(
|
|
301
|
-
this._viewMode =
|
|
300
|
+
setViewMode(e) {
|
|
301
|
+
this._viewMode = e, this.notifyChannels("viewMode");
|
|
302
302
|
}
|
|
303
|
-
setActiveTab(
|
|
304
|
-
this._activeTab =
|
|
303
|
+
setActiveTab(e) {
|
|
304
|
+
this._activeTab = e, this.notifyChannels("activeTab");
|
|
305
305
|
}
|
|
306
306
|
// ── Row Operations ─────────────────────────────────────────
|
|
307
307
|
/** Add a row at the given index (or at the end) */
|
|
308
|
-
addRow(
|
|
308
|
+
addRow(e, o) {
|
|
309
309
|
this.history.push(this.design);
|
|
310
|
-
const n = this.design.body.rows, i = structuredClone(
|
|
310
|
+
const n = this.design.body.rows, i = structuredClone(e);
|
|
311
311
|
o !== void 0 && o >= 0 && o <= n.length ? n.splice(o, 0, i) : n.push(i), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", i);
|
|
312
312
|
}
|
|
313
313
|
/** Remove a row by ID */
|
|
314
|
-
removeRow(
|
|
315
|
-
const o = F(this.design,
|
|
316
|
-
o !== -1 && (this.history.push(this.design), this.design.body.rows.splice(o, 1), this._selectedId ===
|
|
314
|
+
removeRow(e) {
|
|
315
|
+
const o = F(this.design, e);
|
|
316
|
+
o !== -1 && (this.history.push(this.design), this.design.body.rows.splice(o, 1), this._selectedId === e && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("row_removed"));
|
|
317
317
|
}
|
|
318
318
|
/** Move a row from one index to another */
|
|
319
|
-
moveRow(
|
|
319
|
+
moveRow(e, o) {
|
|
320
320
|
this.history.push(this.design);
|
|
321
|
-
const n = this.design.body.rows, [i] = n.splice(
|
|
321
|
+
const n = this.design.body.rows, [i] = n.splice(e, 1);
|
|
322
322
|
n.splice(o, 0, i), this.notifyChannels("design"), this.emitUpdate("row_reordered");
|
|
323
323
|
}
|
|
324
324
|
/** Duplicate a row, assigning fresh IDs to all nested elements */
|
|
325
|
-
duplicateRow(
|
|
326
|
-
const o = U(this.design,
|
|
325
|
+
duplicateRow(e) {
|
|
326
|
+
const o = U(this.design, e);
|
|
327
327
|
if (!o) return;
|
|
328
328
|
this.history.push(this.design);
|
|
329
329
|
const n = structuredClone(o), i = this.counterManager.next("u_row");
|
|
330
330
|
n.id = `u_row_${i}`, n.values._meta = { htmlID: n.id, htmlClassNames: "u_row" };
|
|
331
331
|
for (const s of n.columns) {
|
|
332
|
-
const
|
|
333
|
-
s.id = `u_column_${
|
|
332
|
+
const l = this.counterManager.next("u_column");
|
|
333
|
+
s.id = `u_column_${l}`, s.values._meta = { htmlID: s.id, htmlClassNames: "u_column" };
|
|
334
334
|
for (const d of s.contents) {
|
|
335
335
|
const p = this.counterManager.next(`u_content_${d.type}`);
|
|
336
336
|
d.id = `u_content_${d.type}_${p}`, d.values._meta = { htmlID: d.id, htmlClassNames: `u_content_${d.type}` };
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
const r = F(this.design,
|
|
339
|
+
const r = F(this.design, e);
|
|
340
340
|
this.design.body.rows.splice(r + 1, 0, n), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", n);
|
|
341
341
|
}
|
|
342
342
|
/** Get the index of a row */
|
|
343
|
-
getRowIndex(
|
|
344
|
-
return F(this.design,
|
|
343
|
+
getRowIndex(e) {
|
|
344
|
+
return F(this.design, e);
|
|
345
345
|
}
|
|
346
346
|
/** Update row-level values */
|
|
347
|
-
updateRowValues(
|
|
348
|
-
const n = U(this.design,
|
|
347
|
+
updateRowValues(e, o) {
|
|
348
|
+
const n = U(this.design, e);
|
|
349
349
|
n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
|
|
350
350
|
}
|
|
351
351
|
// ── Column Operations ──────────────────────────────────────
|
|
352
352
|
/** Update column-level values */
|
|
353
|
-
updateColumnValues(
|
|
354
|
-
const n =
|
|
353
|
+
updateColumnValues(e, o) {
|
|
354
|
+
const n = H(this.design, e);
|
|
355
355
|
n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
|
|
356
356
|
}
|
|
357
357
|
// ── Content Operations ─────────────────────────────────────
|
|
358
358
|
/** Add content to a column at the given index */
|
|
359
|
-
addContent(
|
|
360
|
-
const i =
|
|
359
|
+
addContent(e, o, n) {
|
|
360
|
+
const i = H(this.design, e);
|
|
361
361
|
if (!i) return;
|
|
362
362
|
this.history.push(this.design);
|
|
363
363
|
const r = structuredClone(o);
|
|
364
364
|
n !== void 0 && n >= 0 && n <= i.contents.length ? i.contents.splice(n, 0, r) : i.contents.push(r), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", r);
|
|
365
365
|
}
|
|
366
366
|
/** Remove a content block by ID */
|
|
367
|
-
removeContent(
|
|
367
|
+
removeContent(e) {
|
|
368
368
|
for (const o of this.design.body.rows)
|
|
369
369
|
for (const n of o.columns) {
|
|
370
|
-
const i = n.contents.findIndex((r) => r.id ===
|
|
370
|
+
const i = n.contents.findIndex((r) => r.id === e);
|
|
371
371
|
if (i !== -1) {
|
|
372
|
-
this.history.push(this.design), n.contents.splice(i, 1), this._selectedId ===
|
|
372
|
+
this.history.push(this.design), n.contents.splice(i, 1), this._selectedId === e && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("content_removed");
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
/** Update content values by ID */
|
|
378
|
-
updateContentValues(
|
|
379
|
-
const n =
|
|
378
|
+
updateContentValues(e, o) {
|
|
379
|
+
const n = O(this.design, e);
|
|
380
380
|
n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
|
|
381
381
|
}
|
|
382
382
|
/** Move a content block to a different column at a given index */
|
|
383
|
-
moveContent(
|
|
384
|
-
const i =
|
|
383
|
+
moveContent(e, o, n) {
|
|
384
|
+
const i = O(this.design, e);
|
|
385
385
|
if (!i) return;
|
|
386
386
|
this.history.push(this.design);
|
|
387
387
|
for (const s of this.design.body.rows)
|
|
388
|
-
for (const
|
|
389
|
-
const d =
|
|
388
|
+
for (const l of s.columns) {
|
|
389
|
+
const d = l.contents.findIndex((p) => p.id === e);
|
|
390
390
|
if (d !== -1) {
|
|
391
|
-
|
|
391
|
+
l.contents.splice(d, 1);
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
const r =
|
|
395
|
+
const r = H(this.design, o);
|
|
396
396
|
r && r.contents.splice(n, 0, i), this.notifyChannels("design"), this.emitUpdate("content_reordered");
|
|
397
397
|
}
|
|
398
398
|
/** Duplicate a content block, inserting the copy right after the original */
|
|
399
|
-
duplicateContent(
|
|
400
|
-
const o =
|
|
399
|
+
duplicateContent(e) {
|
|
400
|
+
const o = O(this.design, e);
|
|
401
401
|
if (o)
|
|
402
402
|
for (const n of this.design.body.rows)
|
|
403
403
|
for (const i of n.columns) {
|
|
404
|
-
const r = i.contents.findIndex((s) => s.id ===
|
|
404
|
+
const r = i.contents.findIndex((s) => s.id === e);
|
|
405
405
|
if (r !== -1) {
|
|
406
406
|
this.history.push(this.design);
|
|
407
|
-
const s = structuredClone(o),
|
|
408
|
-
s.id = `u_content_${o.type}_${
|
|
407
|
+
const s = structuredClone(o), l = this.counterManager.next(`u_content_${o.type}`);
|
|
408
|
+
s.id = `u_content_${o.type}_${l}`, s.values._meta = { htmlID: s.id, htmlClassNames: `u_content_${o.type}` }, i.contents.splice(r + 1, 0, s), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", s);
|
|
409
409
|
return;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
// ── Body Values ────────────────────────────────────────────
|
|
414
414
|
/** Update body-level values (background, fonts, etc.) */
|
|
415
|
-
updateBodyValues(
|
|
416
|
-
this.history.push(this.design), Object.assign(this.design.body.values,
|
|
415
|
+
updateBodyValues(e) {
|
|
416
|
+
this.history.push(this.design), Object.assign(this.design.body.values, e), this.notifyChannels("design"), this.emitUpdate("body_updated");
|
|
417
417
|
}
|
|
418
418
|
// ── Lookups (delegate to design-lookup) ────────────────────
|
|
419
|
-
findRow(
|
|
420
|
-
return U(this.design,
|
|
419
|
+
findRow(e) {
|
|
420
|
+
return U(this.design, e);
|
|
421
421
|
}
|
|
422
|
-
findColumn(
|
|
423
|
-
return
|
|
422
|
+
findColumn(e) {
|
|
423
|
+
return H(this.design, e);
|
|
424
424
|
}
|
|
425
|
-
findContent(
|
|
426
|
-
return
|
|
425
|
+
findContent(e) {
|
|
426
|
+
return O(this.design, e);
|
|
427
427
|
}
|
|
428
|
-
findParentColumn(
|
|
429
|
-
return
|
|
428
|
+
findParentColumn(e) {
|
|
429
|
+
return gt(this.design, e);
|
|
430
430
|
}
|
|
431
|
-
findParentRow(
|
|
432
|
-
return
|
|
431
|
+
findParentRow(e) {
|
|
432
|
+
return bt(this.design, e);
|
|
433
433
|
}
|
|
434
434
|
// ── Factory Methods (delegate to design-factory) ───────────
|
|
435
435
|
/** Create a new row with the given column layout */
|
|
436
|
-
createRow(
|
|
437
|
-
const o =
|
|
436
|
+
createRow(e) {
|
|
437
|
+
const o = ht(this.counterManager, e);
|
|
438
438
|
return this.syncCounters(), o;
|
|
439
439
|
}
|
|
440
440
|
/** Create a new content block for the given tool type */
|
|
441
|
-
createContent(
|
|
442
|
-
const n =
|
|
441
|
+
createContent(e, o = {}) {
|
|
442
|
+
const n = ut(this.counterManager, e, o);
|
|
443
443
|
return this.syncCounters(), n;
|
|
444
444
|
}
|
|
445
445
|
// ── Private Helpers ────────────────────────────────────────
|
|
446
446
|
syncCounters() {
|
|
447
447
|
this.design.counters = this.counterManager.getCounters();
|
|
448
448
|
}
|
|
449
|
-
emitUpdate(
|
|
450
|
-
this.events.emit("design:updated", { type:
|
|
449
|
+
emitUpdate(e, o) {
|
|
450
|
+
this.events.emit("design:updated", { type: e, item: o });
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
453
|
+
class mt {
|
|
454
454
|
constructor() {
|
|
455
455
|
this.tools = /* @__PURE__ */ new Map(), this.lazyLoaders = /* @__PURE__ */ new Map(), this.lazyMeta = /* @__PURE__ */ new Map(), this.loadingPromises = /* @__PURE__ */ new Map();
|
|
456
456
|
}
|
|
457
457
|
/** Register a tool eagerly (available immediately) */
|
|
458
|
-
register(
|
|
459
|
-
this.tools.set(
|
|
458
|
+
register(e) {
|
|
459
|
+
this.tools.set(e.name, e), this.lazyLoaders.delete(e.name), this.lazyMeta.delete(e.name);
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
462
462
|
* Register a tool lazily. The tool's code is only loaded when first needed.
|
|
@@ -473,56 +473,56 @@ class gt {
|
|
|
473
473
|
* );
|
|
474
474
|
* ```
|
|
475
475
|
*/
|
|
476
|
-
registerLazy(
|
|
477
|
-
this.tools.has(
|
|
476
|
+
registerLazy(e, o) {
|
|
477
|
+
this.tools.has(e.name) || (this.lazyMeta.set(e.name, e), this.lazyLoaders.set(e.name, o));
|
|
478
478
|
}
|
|
479
479
|
/** Get a tool by name. Returns undefined if not loaded yet (use ensureLoaded for lazy tools). */
|
|
480
|
-
get(
|
|
481
|
-
return this.tools.get(
|
|
480
|
+
get(e) {
|
|
481
|
+
return this.tools.get(e);
|
|
482
482
|
}
|
|
483
483
|
/** Check if a tool is registered (eager or lazy) */
|
|
484
|
-
has(
|
|
485
|
-
return this.tools.has(
|
|
484
|
+
has(e) {
|
|
485
|
+
return this.tools.has(e) || this.lazyLoaders.has(e);
|
|
486
486
|
}
|
|
487
487
|
/** Check if a tool is fully loaded and ready to render */
|
|
488
|
-
isLoaded(
|
|
489
|
-
return this.tools.has(
|
|
488
|
+
isLoaded(e) {
|
|
489
|
+
return this.tools.has(e);
|
|
490
490
|
}
|
|
491
491
|
/**
|
|
492
492
|
* Ensure a lazy tool is loaded. Returns the tool definition.
|
|
493
493
|
* If the tool is already loaded, returns it immediately.
|
|
494
494
|
* If it's being loaded, returns the in-flight promise.
|
|
495
495
|
*/
|
|
496
|
-
async ensureLoaded(
|
|
497
|
-
if (this.tools.has(
|
|
498
|
-
if (this.loadingPromises.has(
|
|
499
|
-
const o = this.lazyLoaders.get(
|
|
496
|
+
async ensureLoaded(e) {
|
|
497
|
+
if (this.tools.has(e)) return this.tools.get(e);
|
|
498
|
+
if (this.loadingPromises.has(e)) return this.loadingPromises.get(e);
|
|
499
|
+
const o = this.lazyLoaders.get(e);
|
|
500
500
|
if (!o) return;
|
|
501
|
-
const n = o().then((i) => (this.tools.set(
|
|
502
|
-
return this.loadingPromises.set(
|
|
501
|
+
const n = o().then((i) => (this.tools.set(e, i), this.lazyLoaders.delete(e), this.lazyMeta.delete(e), this.loadingPromises.delete(e), i));
|
|
502
|
+
return this.loadingPromises.set(e, n), n;
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
505
|
* Get all tools for display in the sidebar palette.
|
|
506
506
|
* Returns both loaded tools and lazy tool metadata, sorted by position.
|
|
507
507
|
*/
|
|
508
508
|
getAll() {
|
|
509
|
-
return Array.from(this.tools.values()).sort((
|
|
509
|
+
return Array.from(this.tools.values()).sort((e, o) => (e.position ?? 0) - (o.position ?? 0));
|
|
510
510
|
}
|
|
511
511
|
/**
|
|
512
512
|
* Get all tool names and display metadata (including lazy tools not yet loaded).
|
|
513
513
|
* Used by the sidebar to show all available tools.
|
|
514
514
|
*/
|
|
515
515
|
getAllMeta() {
|
|
516
|
-
const
|
|
516
|
+
const e = [];
|
|
517
517
|
for (const o of this.tools.values())
|
|
518
|
-
|
|
518
|
+
e.push({ name: o.name, label: o.label, icon: o.icon, position: o.position });
|
|
519
519
|
for (const o of this.lazyMeta.values())
|
|
520
|
-
|
|
521
|
-
return
|
|
520
|
+
e.push(o);
|
|
521
|
+
return e.sort((o, n) => (o.position ?? 0) - (n.position ?? 0));
|
|
522
522
|
}
|
|
523
523
|
/** Get default values for a tool. Loads lazily if needed (sync — returns empty if not loaded). */
|
|
524
|
-
getDefaultValues(
|
|
525
|
-
const o = this.tools.get(
|
|
524
|
+
getDefaultValues(e) {
|
|
525
|
+
const o = this.tools.get(e);
|
|
526
526
|
if (!o) return {};
|
|
527
527
|
const n = { ...o.defaultValues };
|
|
528
528
|
for (const i of Object.values(o.options))
|
|
@@ -531,68 +531,68 @@ class gt {
|
|
|
531
531
|
return n;
|
|
532
532
|
}
|
|
533
533
|
/** Get property groups for a tool */
|
|
534
|
-
getPropertyGroups(
|
|
535
|
-
return this.tools.get(
|
|
534
|
+
getPropertyGroups(e) {
|
|
535
|
+
return this.tools.get(e)?.options ?? {};
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
const
|
|
538
|
+
const E = {
|
|
539
539
|
/** ID of the content currently being dragged (null if not dragging content) */
|
|
540
540
|
draggingContentId: null,
|
|
541
|
-
startContentDrag(
|
|
542
|
-
this.draggingContentId =
|
|
541
|
+
startContentDrag(t) {
|
|
542
|
+
this.draggingContentId = t;
|
|
543
543
|
},
|
|
544
544
|
reset() {
|
|
545
545
|
this.draggingContentId = null;
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
|
-
function J(
|
|
549
|
-
const
|
|
550
|
-
return Object.assign(
|
|
548
|
+
function J(t) {
|
|
549
|
+
const e = document.createElement("div");
|
|
550
|
+
return Object.assign(e.style, {
|
|
551
551
|
position: "absolute",
|
|
552
552
|
left: "0",
|
|
553
553
|
right: "0",
|
|
554
554
|
height: "3px",
|
|
555
|
-
background:
|
|
555
|
+
background: t,
|
|
556
556
|
borderRadius: "2px",
|
|
557
557
|
pointerEvents: "none",
|
|
558
558
|
zIndex: "1000",
|
|
559
559
|
display: "none",
|
|
560
|
-
boxShadow: `0 0 6px ${
|
|
561
|
-
}),
|
|
560
|
+
boxShadow: `0 0 6px ${t}80`
|
|
561
|
+
}), e;
|
|
562
562
|
}
|
|
563
|
-
function X(
|
|
564
|
-
|
|
565
|
-
const s = (
|
|
566
|
-
let
|
|
567
|
-
o.length === 0 || n === 0 ?
|
|
563
|
+
function X(t, e, o, n, i = "4px") {
|
|
564
|
+
t.parentNode !== e && (t.remove(), e.appendChild(t));
|
|
565
|
+
const s = (e instanceof ShadowRoot ? e.host : e).getBoundingClientRect();
|
|
566
|
+
let l;
|
|
567
|
+
o.length === 0 || n === 0 ? l = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - s.top : n >= o.length ? l = o[o.length - 1].getBoundingClientRect().bottom - s.top : l = o[n].getBoundingClientRect().top - s.top, Object.assign(t.style, {
|
|
568
568
|
display: "block",
|
|
569
|
-
top: `${
|
|
569
|
+
top: `${l}px`,
|
|
570
570
|
left: i,
|
|
571
571
|
right: i,
|
|
572
572
|
width: "auto"
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
|
|
575
|
+
function M(t) {
|
|
576
|
+
t && (t.style.display = "none");
|
|
577
577
|
}
|
|
578
|
-
function N(
|
|
579
|
-
const o = (
|
|
578
|
+
function N(t, e) {
|
|
579
|
+
const o = (t instanceof ShadowRoot, t.children);
|
|
580
580
|
for (const n of Array.from(o)) {
|
|
581
581
|
const i = n;
|
|
582
|
-
|
|
582
|
+
e(i), i.shadowRoot && N(i.shadowRoot, e), i.children?.length && N(i, e);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
-
function Q(
|
|
585
|
+
function Q(t, e) {
|
|
586
586
|
const o = [];
|
|
587
|
-
return N(
|
|
588
|
-
n.matches?.(
|
|
587
|
+
return N(t, (n) => {
|
|
588
|
+
n.matches?.(e) && o.push(n);
|
|
589
589
|
}), o;
|
|
590
590
|
}
|
|
591
|
-
class
|
|
592
|
-
constructor(
|
|
591
|
+
class xt {
|
|
592
|
+
constructor(e, o, n) {
|
|
593
593
|
this.currentDrop = null, this.contentIndicator = null, this.rowIndicator = null, this.onDragOver = (i) => {
|
|
594
|
-
const r = i.dataTransfer?.types || [], s = r.includes("application/maileditor-tool"),
|
|
595
|
-
!s && !d && !
|
|
594
|
+
const r = i.dataTransfer?.types || [], s = r.includes("application/maileditor-tool"), l = r.includes("application/maileditor-layout"), d = r.includes("application/maileditor-content") || !!E.draggingContentId;
|
|
595
|
+
!s && !d && !l || (i.preventDefault(), i.dataTransfer.dropEffect = s || l ? "copy" : "move", l ? (this.currentDrop = this.findRowDropTarget(i.clientY), M(this.contentIndicator), this.showRowIndicator()) : (this.currentDrop = this.findContentDropTarget(i.clientX, i.clientY), M(this.rowIndicator), this.showContentIndicator()));
|
|
596
596
|
}, this.onDrop = (i) => {
|
|
597
597
|
i.preventDefault(), this.hideAllIndicators();
|
|
598
598
|
const r = this.currentDrop, s = i.dataTransfer?.getData("application/maileditor-layout");
|
|
@@ -600,19 +600,19 @@ class bt {
|
|
|
600
600
|
this.handleLayoutDrop(JSON.parse(s), r), this.reset();
|
|
601
601
|
return;
|
|
602
602
|
}
|
|
603
|
-
const
|
|
604
|
-
if (
|
|
605
|
-
this.handleToolDrop(
|
|
603
|
+
const l = i.dataTransfer?.getData("application/maileditor-tool");
|
|
604
|
+
if (l) {
|
|
605
|
+
this.handleToolDrop(l, r), this.reset();
|
|
606
606
|
return;
|
|
607
607
|
}
|
|
608
|
-
const d = i.dataTransfer?.getData("application/maileditor-content") ||
|
|
608
|
+
const d = i.dataTransfer?.getData("application/maileditor-content") || E.draggingContentId;
|
|
609
609
|
d && this.handleContentDrop(d, r), this.reset();
|
|
610
610
|
}, this.onDragEnd = () => {
|
|
611
611
|
this.hideAllIndicators(), this.reset();
|
|
612
612
|
}, this.onDragLeave = (i) => {
|
|
613
613
|
const r = i.relatedTarget;
|
|
614
614
|
(!r || !this.root.contains(r)) && (this.hideAllIndicators(), this.currentDrop = null);
|
|
615
|
-
}, this.store =
|
|
615
|
+
}, this.store = e, this.toolRegistry = o, this.root = n;
|
|
616
616
|
}
|
|
617
617
|
/** Attach all drag event listeners to the shadow root */
|
|
618
618
|
attach() {
|
|
@@ -623,57 +623,57 @@ class bt {
|
|
|
623
623
|
this.root.removeEventListener("dragover", this.onDragOver), this.root.removeEventListener("drop", this.onDrop), this.root.removeEventListener("dragend", this.onDragEnd), this.root.removeEventListener("dragleave", this.onDragLeave), this.contentIndicator?.remove(), this.rowIndicator?.remove();
|
|
624
624
|
}
|
|
625
625
|
// ── Drop Handlers ──────────────────────────────────────────
|
|
626
|
-
handleLayoutDrop(
|
|
627
|
-
const n = this.store.createRow(
|
|
626
|
+
handleLayoutDrop(e, o = this.currentDrop) {
|
|
627
|
+
const n = this.store.createRow(e), i = o?.type === "row" ? o.rowIndex : void 0;
|
|
628
628
|
this.store.addRow(n, i);
|
|
629
629
|
}
|
|
630
|
-
async handleToolDrop(
|
|
631
|
-
if (await this.toolRegistry.ensureLoaded(
|
|
632
|
-
const n = this.toolRegistry.getDefaultValues(
|
|
630
|
+
async handleToolDrop(e, o) {
|
|
631
|
+
if (await this.toolRegistry.ensureLoaded(e), o?.type === "content" && o.columnId) {
|
|
632
|
+
const n = this.toolRegistry.getDefaultValues(e), i = this.store.createContent(e, n);
|
|
633
633
|
this.store.addContent(o.columnId, i, o.contentIndex), this.store.select(i.id);
|
|
634
634
|
} else {
|
|
635
635
|
const n = this.store.createRow([1]);
|
|
636
636
|
this.store.addRow(n);
|
|
637
|
-
const i = this.toolRegistry.getDefaultValues(
|
|
637
|
+
const i = this.toolRegistry.getDefaultValues(e), r = this.store.createContent(e, i);
|
|
638
638
|
this.store.addContent(n.columns[0].id, r), this.store.select(r.id);
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
handleContentDrop(
|
|
642
|
-
o?.type === "content" && o.columnId && (this.store.moveContent(
|
|
641
|
+
handleContentDrop(e, o) {
|
|
642
|
+
o?.type === "content" && o.columnId && (this.store.moveContent(e, o.columnId, o.contentIndex), this.store.select(e));
|
|
643
643
|
}
|
|
644
644
|
// ── Drop Target Detection ─────────────────────────────────
|
|
645
|
-
findRowDropTarget(
|
|
645
|
+
findRowDropTarget(e) {
|
|
646
646
|
const o = this.root.querySelector("me-editor-canvas");
|
|
647
647
|
if (!o?.shadowRoot) return null;
|
|
648
648
|
const n = Array.from(o.shadowRoot.querySelectorAll("me-row-renderer"));
|
|
649
649
|
if (n.length === 0) return { type: "row", rowIndex: 0, y: 0 };
|
|
650
|
-
let i = Math.abs(
|
|
650
|
+
let i = Math.abs(e - n[0].getBoundingClientRect().top), r = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
|
|
651
651
|
for (let s = 0; s < n.length; s++) {
|
|
652
|
-
const
|
|
653
|
-
d < i && (i = d, r = { type: "row", rowIndex: s + 1, y:
|
|
652
|
+
const l = n[s].getBoundingClientRect().bottom, d = Math.abs(e - l);
|
|
653
|
+
d < i && (i = d, r = { type: "row", rowIndex: s + 1, y: l });
|
|
654
654
|
}
|
|
655
655
|
return r;
|
|
656
656
|
}
|
|
657
|
-
findContentDropTarget(
|
|
657
|
+
findContentDropTarget(e, o) {
|
|
658
658
|
const n = Q(this.root, "me-column-renderer");
|
|
659
659
|
let i = null, r = 1 / 0;
|
|
660
660
|
for (const s of n) {
|
|
661
|
-
const
|
|
662
|
-
if (!
|
|
661
|
+
const l = s.dataset.columnId;
|
|
662
|
+
if (!l || !s.shadowRoot) continue;
|
|
663
663
|
const d = s.getBoundingClientRect();
|
|
664
|
-
if (
|
|
664
|
+
if (e < d.left || e > d.right) continue;
|
|
665
665
|
const p = Array.from(s.shadowRoot.querySelectorAll("me-content-renderer"));
|
|
666
666
|
if (p.length === 0) {
|
|
667
667
|
const u = Math.abs(o - (d.top + d.height / 2));
|
|
668
|
-
u < r && (r = u, i = { type: "content", columnId:
|
|
668
|
+
u < r && (r = u, i = { type: "content", columnId: l, contentIndex: 0, y: d.top + d.height / 2 });
|
|
669
669
|
continue;
|
|
670
670
|
}
|
|
671
671
|
const h = p[0].getBoundingClientRect().top;
|
|
672
672
|
let g = Math.abs(o - h);
|
|
673
|
-
g < r && (r = g, i = { type: "content", columnId:
|
|
673
|
+
g < r && (r = g, i = { type: "content", columnId: l, contentIndex: 0, y: h });
|
|
674
674
|
for (let u = 0; u < p.length; u++) {
|
|
675
|
-
const m = p[u].getBoundingClientRect(), x = p[u + 1]?.getBoundingClientRect(),
|
|
676
|
-
g = Math.abs(o -
|
|
675
|
+
const m = p[u].getBoundingClientRect(), x = p[u + 1]?.getBoundingClientRect(), b = x ? (m.bottom + x.top) / 2 : m.bottom;
|
|
676
|
+
g = Math.abs(o - b), g < r && (r = g, i = { type: "content", columnId: l, contentIndex: u + 1, y: b });
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
return i;
|
|
@@ -681,7 +681,7 @@ class bt {
|
|
|
681
681
|
// ── Indicator Positioning ──────────────────────────────────
|
|
682
682
|
showContentIndicator() {
|
|
683
683
|
if (!this.contentIndicator || !this.currentDrop?.columnId) {
|
|
684
|
-
|
|
684
|
+
M(this.contentIndicator);
|
|
685
685
|
return;
|
|
686
686
|
}
|
|
687
687
|
const o = Q(this.root, "me-column-renderer").find((i) => i.dataset.columnId === this.currentDrop.columnId);
|
|
@@ -691,53 +691,96 @@ class bt {
|
|
|
691
691
|
}
|
|
692
692
|
showRowIndicator() {
|
|
693
693
|
if (!this.rowIndicator || !this.currentDrop) {
|
|
694
|
-
|
|
694
|
+
M(this.rowIndicator);
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
const
|
|
697
|
+
const e = this.root.querySelector("me-editor-canvas"), o = e?.shadowRoot?.querySelector(".canvas-body");
|
|
698
698
|
if (!o) return;
|
|
699
|
-
const n = Array.from(
|
|
699
|
+
const n = Array.from(e.shadowRoot.querySelectorAll("me-row-renderer"));
|
|
700
700
|
X(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
|
|
701
701
|
}
|
|
702
702
|
hideAllIndicators() {
|
|
703
|
-
|
|
703
|
+
M(this.contentIndicator), M(this.rowIndicator);
|
|
704
704
|
}
|
|
705
705
|
reset() {
|
|
706
|
-
this.currentDrop = null,
|
|
706
|
+
this.currentDrop = null, E.reset();
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function a(t, e, o = "") {
|
|
710
|
+
const n = t[e];
|
|
711
|
+
return typeof n == "string" && n !== "" ? n : typeof n == "number" ? String(n) : o;
|
|
712
|
+
}
|
|
713
|
+
function Z(t) {
|
|
714
|
+
return typeof t == "string" ? t : t && typeof t == "object" && "url" in t && t.url || "";
|
|
715
|
+
}
|
|
716
|
+
function tt(t) {
|
|
717
|
+
if (t && typeof t == "object") {
|
|
718
|
+
const e = t;
|
|
719
|
+
return {
|
|
720
|
+
width: typeof e.width == "number" ? e.width : void 0,
|
|
721
|
+
maxWidth: typeof e.maxWidth == "string" ? e.maxWidth : void 0
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
return {};
|
|
725
|
+
}
|
|
726
|
+
function yt(t) {
|
|
727
|
+
const e = t.action;
|
|
728
|
+
if (e && typeof e == "object") {
|
|
729
|
+
const o = e.values;
|
|
730
|
+
return {
|
|
731
|
+
href: o?.href || "",
|
|
732
|
+
target: o?.target || "_blank"
|
|
733
|
+
};
|
|
707
734
|
}
|
|
735
|
+
return {
|
|
736
|
+
href: a(t, "href"),
|
|
737
|
+
target: a(t, "target", "_blank")
|
|
738
|
+
};
|
|
708
739
|
}
|
|
709
|
-
function
|
|
710
|
-
const
|
|
711
|
-
|
|
740
|
+
function et(t, e = "") {
|
|
741
|
+
const o = t.text;
|
|
742
|
+
if (typeof o == "string" && o !== "") return o;
|
|
743
|
+
const n = t.textJson;
|
|
744
|
+
if (typeof n == "string")
|
|
745
|
+
try {
|
|
746
|
+
const i = JSON.parse(n), r = [], s = (l) => {
|
|
747
|
+
typeof l.text == "string" && r.push(l.text), l.type === "linebreak" && r.push("<br/>");
|
|
748
|
+
const d = l.children;
|
|
749
|
+
d && d.forEach(s);
|
|
750
|
+
};
|
|
751
|
+
if (s(i.root || i), r.length > 0) return r.join("");
|
|
752
|
+
} catch {
|
|
753
|
+
}
|
|
754
|
+
return e;
|
|
712
755
|
}
|
|
713
|
-
function
|
|
714
|
-
if (typeof
|
|
756
|
+
function se(t, e) {
|
|
757
|
+
if (typeof t != "string") return e;
|
|
715
758
|
try {
|
|
716
|
-
return JSON.parse(
|
|
759
|
+
return JSON.parse(t);
|
|
717
760
|
} catch {
|
|
718
|
-
return
|
|
761
|
+
return e;
|
|
719
762
|
}
|
|
720
763
|
}
|
|
721
|
-
function
|
|
722
|
-
const { padding: o, align: n = "left", extraTdStyle: i = "" } =
|
|
764
|
+
function V(t, e) {
|
|
765
|
+
const { padding: o, align: n = "left", extraTdStyle: i = "" } = e;
|
|
723
766
|
return `<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
|
724
767
|
<tbody><tr><td style="${`overflow-wrap:break-word;word-break:break-word;padding:${o};font-family:arial,helvetica,sans-serif;${i}`}" align="${n}">
|
|
725
|
-
${
|
|
768
|
+
${t}
|
|
726
769
|
</td></tr></tbody>
|
|
727
770
|
</table>`;
|
|
728
771
|
}
|
|
729
|
-
function
|
|
730
|
-
const { bgColor: n, textColor: i, fontSize: r, fontWeight: s, borderRadius:
|
|
772
|
+
function wt(t, e, o) {
|
|
773
|
+
const { bgColor: n, textColor: i, fontSize: r, fontWeight: s, borderRadius: l } = o, d = parseInt(l) || 0;
|
|
731
774
|
if (d <= 0) return "";
|
|
732
775
|
const p = Math.round(d / 20 * 100);
|
|
733
776
|
return `<!--[if mso]>
|
|
734
|
-
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${
|
|
777
|
+
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${e}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${p}%" stroke="f" fillcolor="${n}">
|
|
735
778
|
<w:anchorlock/>
|
|
736
|
-
<center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${s};">${
|
|
779
|
+
<center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${s};">${t}</center>
|
|
737
780
|
</v:roundrect>
|
|
738
781
|
<![endif]-->`;
|
|
739
782
|
}
|
|
740
|
-
const
|
|
783
|
+
const vt = {
|
|
741
784
|
name: "text",
|
|
742
785
|
label: "Text",
|
|
743
786
|
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="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg>',
|
|
@@ -799,20 +842,20 @@ const mt = {
|
|
|
799
842
|
textAlign: "left"
|
|
800
843
|
},
|
|
801
844
|
renderer: {
|
|
802
|
-
renderEditor(
|
|
803
|
-
const
|
|
845
|
+
renderEditor(t) {
|
|
846
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor", "transparent"), n = a(t, "color", "inherit"), i = a(t, "lineHeight", "140%"), r = a(t, "text");
|
|
804
847
|
return c`
|
|
805
|
-
<div style="padding:${
|
|
848
|
+
<div style="padding:${e};background-color:${o};color:${n};line-height:${i};word-break:break-word;">
|
|
806
849
|
${q(r)}
|
|
807
850
|
</div>
|
|
808
851
|
`;
|
|
809
852
|
},
|
|
810
|
-
renderHtml(
|
|
811
|
-
const
|
|
812
|
-
return
|
|
853
|
+
renderHtml(t) {
|
|
854
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor"), n = a(t, "color", "#000000"), i = a(t, "lineHeight", "140%"), r = a(t, "textAlign", "left"), s = a(t, "text"), l = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${r};word-wrap:break-word;">${s}</div>`;
|
|
855
|
+
return V(d, { padding: e, extraTdStyle: l });
|
|
813
856
|
}
|
|
814
857
|
}
|
|
815
|
-
},
|
|
858
|
+
}, $t = {
|
|
816
859
|
name: "heading",
|
|
817
860
|
label: "Heading",
|
|
818
861
|
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>',
|
|
@@ -913,20 +956,20 @@ const mt = {
|
|
|
913
956
|
containerPadding: "10px"
|
|
914
957
|
},
|
|
915
958
|
renderer: {
|
|
916
|
-
renderEditor(
|
|
917
|
-
const
|
|
959
|
+
renderEditor(t) {
|
|
960
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "fontSize", "22px"), n = a(t, "color", "#000000"), i = a(t, "textAlign", "left"), r = a(t, "fontWeight", "700"), s = a(t, "lineHeight", "140%"), l = et(t, "Heading");
|
|
918
961
|
return c`
|
|
919
|
-
<div style="padding:${
|
|
920
|
-
${
|
|
962
|
+
<div style="padding:${e};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};">
|
|
963
|
+
${l}
|
|
921
964
|
</div>
|
|
922
965
|
`;
|
|
923
966
|
},
|
|
924
|
-
renderHtml(
|
|
925
|
-
const
|
|
926
|
-
return
|
|
967
|
+
renderHtml(t) {
|
|
968
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "fontSize", "22px"), n = a(t, "color", "#000000"), i = a(t, "textAlign", "left"), r = a(t, "fontWeight", "700"), s = a(t, "lineHeight", "140%"), l = a(t, "letterSpacing", "normal"), d = a(t, "headingType", "h1"), p = et(t, "Heading"), h = `<${d} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};letter-spacing:${l};">${p}</${d}>`;
|
|
969
|
+
return V(h, { padding: e });
|
|
927
970
|
}
|
|
928
971
|
}
|
|
929
|
-
},
|
|
972
|
+
}, kt = {
|
|
930
973
|
name: "paragraph",
|
|
931
974
|
label: "Paragraph",
|
|
932
975
|
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>',
|
|
@@ -968,16 +1011,16 @@ const mt = {
|
|
|
968
1011
|
containerPadding: "10px"
|
|
969
1012
|
},
|
|
970
1013
|
renderer: {
|
|
971
|
-
renderEditor(
|
|
972
|
-
const
|
|
973
|
-
return c`<div style="padding:${
|
|
1014
|
+
renderEditor(t) {
|
|
1015
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "color", "#374151"), n = a(t, "lineHeight", "160%");
|
|
1016
|
+
return c`<div style="padding:${e};color:${o};line-height:${n};word-break:break-word;">${q(a(t, "text"))}</div>`;
|
|
974
1017
|
},
|
|
975
|
-
renderHtml(
|
|
976
|
-
const
|
|
977
|
-
return
|
|
1018
|
+
renderHtml(t) {
|
|
1019
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "color", "#374151"), n = a(t, "lineHeight", "160%"), i = a(t, "textAlign", "left"), r = a(t, "letterSpacing", "normal"), s = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${r};word-wrap:break-word;">${a(t, "text")}</div>`;
|
|
1020
|
+
return V(s, { padding: e });
|
|
978
1021
|
}
|
|
979
1022
|
}
|
|
980
|
-
},
|
|
1023
|
+
}, Ct = {
|
|
981
1024
|
name: "image",
|
|
982
1025
|
label: "Image",
|
|
983
1026
|
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>',
|
|
@@ -1037,16 +1080,16 @@ const mt = {
|
|
|
1037
1080
|
containerPadding: "10px"
|
|
1038
1081
|
},
|
|
1039
1082
|
renderer: {
|
|
1040
|
-
renderEditor(
|
|
1041
|
-
const
|
|
1042
|
-
return o ? c`<div style="padding:${
|
|
1083
|
+
renderEditor(t) {
|
|
1084
|
+
const e = a(t, "containerPadding", "10px"), o = Z(t.src), n = a(t, "alt"), r = tt(t.src).maxWidth || a(t, "width", "100%"), s = a(t, "borderRadius", "0px"), l = a(t, "textAlign", a(t, "align", "center"));
|
|
1085
|
+
return o ? c`<div style="padding:${e};text-align:${l};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${r};border-radius:${s};border:0;" /></div>` : c`<div style="padding:${e};text-align:${l};"><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>`;
|
|
1043
1086
|
},
|
|
1044
|
-
renderHtml(
|
|
1045
|
-
const o =
|
|
1046
|
-
return
|
|
1087
|
+
renderHtml(t, e) {
|
|
1088
|
+
const o = a(t, "containerPadding", "10px"), n = Z(t.src), i = a(t, "alt"), r = yt(t), l = tt(t.src).maxWidth || a(t, "width", "100%"), d = a(t, "borderRadius", "0px"), p = a(t, "textAlign", a(t, "align", "center")), h = l === "100%" ? e.columnWidth : parseInt(l) || e.columnWidth, g = d !== "0px" ? `border-radius:${d};` : "", u = `<img align="${p}" border="0" src="${n}" alt="${i}" title="${i}" style="outline:none;text-decoration:none;clear:both;display:inline-block!important;border:none;height:auto;float:none;width:${l};max-width:${h}px;${g}" width="${h}" />`, m = r.href ? `<a href="${r.href}" target="${r.target}" style="text-decoration:none;">${u}</a>` : u;
|
|
1089
|
+
return V(m, { padding: o, align: p });
|
|
1047
1090
|
}
|
|
1048
1091
|
}
|
|
1049
|
-
},
|
|
1092
|
+
}, _t = {
|
|
1050
1093
|
name: "button",
|
|
1051
1094
|
label: "Button",
|
|
1052
1095
|
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>',
|
|
@@ -1132,25 +1175,25 @@ const mt = {
|
|
|
1132
1175
|
containerPadding: "10px"
|
|
1133
1176
|
},
|
|
1134
1177
|
renderer: {
|
|
1135
|
-
renderEditor(
|
|
1136
|
-
const
|
|
1178
|
+
renderEditor(t) {
|
|
1179
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor", "#3b82f6"), n = a(t, "textColor", "#ffffff"), i = a(t, "fontSize", "14px"), r = a(t, "fontWeight", "700"), s = a(t, "borderRadius", "4px"), l = a(t, "buttonPadding", "10px 20px"), d = a(t, "text", "Click Me"), p = a(t, "textAlign", "center"), h = a(t, "buttonWidth", "auto"), g = a(t, "borderWidth", "0px"), u = a(t, "borderColor", o), m = g !== "0px" ? `border:${g} solid ${u};` : "border:none;", x = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
|
|
1137
1180
|
return c`
|
|
1138
|
-
<div style="padding:${
|
|
1139
|
-
<a style="${x}background-color:${o};color:${n};font-size:${i};font-weight:${r};border-radius:${s};padding:${
|
|
1181
|
+
<div style="padding:${e};text-align:${p};">
|
|
1182
|
+
<a style="${x}background-color:${o};color:${n};font-size:${i};font-weight:${r};border-radius:${s};padding:${l};text-decoration:none;text-align:center;${m}cursor:pointer;font-family:arial,helvetica,sans-serif;box-sizing:border-box;">${d}</a>
|
|
1140
1183
|
</div>
|
|
1141
1184
|
`;
|
|
1142
1185
|
},
|
|
1143
|
-
renderHtml(
|
|
1144
|
-
const
|
|
1145
|
-
<!--[if !mso]><!-->` : "<!--[if !mso]><!-->",
|
|
1146
|
-
${
|
|
1147
|
-
<a href="${h}" target="${g}" style="box-sizing:border-box;display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${s};font-size:${i};font-weight:${r};padding:${
|
|
1186
|
+
renderHtml(t) {
|
|
1187
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "backgroundColor", "#3b82f6"), n = a(t, "textColor", "#ffffff"), i = a(t, "fontSize", "14px"), r = a(t, "fontWeight", "700"), s = a(t, "borderRadius", "4px"), l = a(t, "buttonPadding", "10px 20px"), d = a(t, "text", "Click Me"), p = a(t, "textAlign", "center"), h = a(t, "href", "#"), g = a(t, "target", "_blank"), u = a(t, "borderWidth", "0px"), m = a(t, "borderColor", o), x = u !== "0px" ? `border:${u} solid ${m};` : "border:none;", b = wt(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: r, borderRadius: s }), y = b ? `${b}
|
|
1188
|
+
<!--[if !mso]><!-->` : "<!--[if !mso]><!-->", z = `<div align="${p}">
|
|
1189
|
+
${y}
|
|
1190
|
+
<a href="${h}" target="${g}" style="box-sizing:border-box;display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${s};font-size:${i};font-weight:${r};padding:${l};font-family:arial,helvetica,sans-serif;${x}mso-border-alt:none;word-break:keep-all;"><span style="line-height:120%;">${d}</span></a>
|
|
1148
1191
|
<!--<![endif]-->
|
|
1149
1192
|
</div>`;
|
|
1150
|
-
return
|
|
1193
|
+
return V(z, { padding: e, align: p });
|
|
1151
1194
|
}
|
|
1152
1195
|
}
|
|
1153
|
-
},
|
|
1196
|
+
}, Dt = {
|
|
1154
1197
|
name: "divider",
|
|
1155
1198
|
label: "Divider",
|
|
1156
1199
|
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>',
|
|
@@ -1196,54 +1239,54 @@ const mt = {
|
|
|
1196
1239
|
containerPadding: "10px"
|
|
1197
1240
|
},
|
|
1198
1241
|
renderer: {
|
|
1199
|
-
renderEditor(
|
|
1200
|
-
const
|
|
1201
|
-
return c`<div style="padding:${
|
|
1242
|
+
renderEditor(t) {
|
|
1243
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "width", "100%"), n = `${a(t, "borderTopWidth", "1px")} ${a(t, "borderTopStyle", "solid")} ${a(t, "borderTopColor", "#cccccc")}`;
|
|
1244
|
+
return c`<div style="padding:${e};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
|
|
1202
1245
|
},
|
|
1203
|
-
renderHtml(
|
|
1204
|
-
const
|
|
1205
|
-
return
|
|
1246
|
+
renderHtml(t) {
|
|
1247
|
+
const e = a(t, "containerPadding", "10px"), o = a(t, "width", "100%"), n = `${a(t, "borderTopWidth", "1px")} ${a(t, "borderTopStyle", "solid")} ${a(t, "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;"> </td></tr></tbody></table>`;
|
|
1248
|
+
return V(i, { padding: e, align: "center" });
|
|
1206
1249
|
}
|
|
1207
1250
|
}
|
|
1208
|
-
},
|
|
1209
|
-
mt,
|
|
1210
|
-
xt,
|
|
1211
|
-
yt,
|
|
1212
|
-
wt,
|
|
1251
|
+
}, St = [
|
|
1213
1252
|
vt,
|
|
1214
|
-
$t
|
|
1215
|
-
|
|
1253
|
+
$t,
|
|
1254
|
+
kt,
|
|
1255
|
+
Ct,
|
|
1256
|
+
_t,
|
|
1257
|
+
Dt
|
|
1258
|
+
], ot = [
|
|
1216
1259
|
{
|
|
1217
1260
|
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 },
|
|
1218
|
-
loader: () => import("./html-tool-
|
|
1261
|
+
loader: () => import("./html-tool-Be4HAhoj.js").then((t) => t.htmlTool)
|
|
1219
1262
|
},
|
|
1220
1263
|
{
|
|
1221
1264
|
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 },
|
|
1222
|
-
loader: () => import("./social-tool-
|
|
1265
|
+
loader: () => import("./social-tool-bc46FNgk.js").then((t) => t.socialTool)
|
|
1223
1266
|
},
|
|
1224
1267
|
{
|
|
1225
1268
|
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 },
|
|
1226
|
-
loader: () => import("./menu-tool-
|
|
1269
|
+
loader: () => import("./menu-tool-HPxxeiRV.js").then((t) => t.menuTool)
|
|
1227
1270
|
},
|
|
1228
1271
|
{
|
|
1229
1272
|
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 },
|
|
1230
|
-
loader: () => import("./video-tool-
|
|
1273
|
+
loader: () => import("./video-tool-CPjCWbTX.js").then((t) => t.videoTool)
|
|
1231
1274
|
},
|
|
1232
1275
|
{
|
|
1233
1276
|
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 },
|
|
1234
|
-
loader: () => import("./timer-tool-
|
|
1277
|
+
loader: () => import("./timer-tool-GPhdsvRE.js").then((t) => t.timerTool)
|
|
1235
1278
|
},
|
|
1236
1279
|
{
|
|
1237
1280
|
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 },
|
|
1238
|
-
loader: () => import("./table-tool-
|
|
1281
|
+
loader: () => import("./table-tool-LzRcAPFb.js").then((t) => t.tableTool)
|
|
1239
1282
|
},
|
|
1240
1283
|
{
|
|
1241
1284
|
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 },
|
|
1242
|
-
loader: () => import("./form-tool-
|
|
1285
|
+
loader: () => import("./form-tool-DSXsWpjQ.js").then((t) => t.formTool)
|
|
1243
1286
|
}
|
|
1244
1287
|
];
|
|
1245
|
-
function
|
|
1246
|
-
const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif", s = o.textColor || "#000000",
|
|
1288
|
+
function Rt(t, e, o) {
|
|
1289
|
+
const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif", s = o.textColor || "#000000", l = o.preheaderText || "", d = l ? `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${l}${"‌ ".repeat(80)}</div>` : "";
|
|
1247
1290
|
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
1248
1291
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
1249
1292
|
<head>
|
|
@@ -1267,7 +1310,7 @@ function Ct(e, t, o) {
|
|
|
1267
1310
|
<![endif]-->
|
|
1268
1311
|
<!--[if !mso]><!-->
|
|
1269
1312
|
<style type="text/css">
|
|
1270
|
-
${
|
|
1313
|
+
${e}
|
|
1271
1314
|
</style>
|
|
1272
1315
|
<!--<![endif]-->
|
|
1273
1316
|
<style type="text/css">
|
|
@@ -1286,7 +1329,7 @@ function Ct(e, t, o) {
|
|
|
1286
1329
|
<tr style="vertical-align:top;">
|
|
1287
1330
|
<td style="word-break:break-word;border-collapse:collapse !important;vertical-align:top;">
|
|
1288
1331
|
<!--[if (mso)|(IE)]><table width="${parseInt(i)}" align="center" cellpadding="0" cellspacing="0" border="0"><tr><td><![endif]-->
|
|
1289
|
-
${
|
|
1332
|
+
${t}
|
|
1290
1333
|
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
|
1291
1334
|
</td>
|
|
1292
1335
|
</tr>
|
|
@@ -1295,20 +1338,20 @@ function Ct(e, t, o) {
|
|
|
1295
1338
|
</body>
|
|
1296
1339
|
</html>`;
|
|
1297
1340
|
}
|
|
1298
|
-
function
|
|
1299
|
-
const n = parseInt(
|
|
1300
|
-
const
|
|
1301
|
-
return
|
|
1302
|
-
}), g =
|
|
1341
|
+
function Mt(t, e, o) {
|
|
1342
|
+
const n = parseInt(e.contentWidth || "600"), i = t.values.backgroundColor || "", r = t.values.columnsBackgroundColor || "", s = t.values.padding || "0px", l = t.cells.reduce((b, y) => b + y, 0), d = i ? `background-color:${i};` : "", p = t.values.backgroundImage?.url ? `background-image:url('${t.values.backgroundImage.url}');background-repeat:${t.values.backgroundImage.repeat ? "repeat" : "no-repeat"};background-position:center top;background-size:${t.values.backgroundImage.cover ? "cover" : "auto"};` : "", h = t.columns.map((b, y) => {
|
|
1343
|
+
const R = Math.round(t.cells[y] / l * n);
|
|
1344
|
+
return nt(b, R, r, e, o);
|
|
1345
|
+
}), g = t.columns.length > 1;
|
|
1303
1346
|
let u;
|
|
1304
1347
|
if (g) {
|
|
1305
|
-
const
|
|
1306
|
-
const
|
|
1307
|
-
return `<!--[if (mso)|(IE)]><td align="center" width="${
|
|
1308
|
-
${
|
|
1348
|
+
const b = t.columns.map((y, R) => {
|
|
1349
|
+
const z = Math.round(t.cells[R] / l * n), at = nt(y, z, r, e, o);
|
|
1350
|
+
return `<!--[if (mso)|(IE)]><td align="center" width="${z}" style="width:${z}px;padding:0px;border:none;" valign="top"><![endif]-->
|
|
1351
|
+
${at}
|
|
1309
1352
|
<!--[if (mso)|(IE)]></td><![endif]-->`;
|
|
1310
1353
|
});
|
|
1311
|
-
u = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${
|
|
1354
|
+
u = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${b.join(`
|
|
1312
1355
|
`)}</tr></table><![endif]-->
|
|
1313
1356
|
|
|
1314
1357
|
<!--[if !mso]><!-->
|
|
@@ -1320,7 +1363,7 @@ ${h.join(`
|
|
|
1320
1363
|
} else
|
|
1321
1364
|
u = h.join(`
|
|
1322
1365
|
`);
|
|
1323
|
-
const m =
|
|
1366
|
+
const m = t.values.hideDesktop ? " u_hide_desktop" : "", x = t.values.hideMobile ? " u_hide_mobile" : "";
|
|
1324
1367
|
return `<div class="u_row${m}${x}" style="padding:${s};${d}${p}">
|
|
1325
1368
|
<div style="margin:0 auto;min-width:320px;max-width:${n}px;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;background-color:transparent;">
|
|
1326
1369
|
<div style="border-collapse:collapse;display:table;width:100%;height:100%;background-color:transparent;">
|
|
@@ -1329,34 +1372,36 @@ ${h.join(`
|
|
|
1329
1372
|
</div>
|
|
1330
1373
|
</div>`;
|
|
1331
1374
|
}
|
|
1332
|
-
function
|
|
1333
|
-
const r =
|
|
1375
|
+
function nt(t, e, o, n, i) {
|
|
1376
|
+
const r = t.values.backgroundColor || o || "", s = t.values.padding || "0px", l = t.values.borderRadius || "0px", d = r ? `background-color:${r};` : "", p = t.contents.map((h) => {
|
|
1334
1377
|
const g = i.get(h.type);
|
|
1335
1378
|
if (!g) return `<!-- unknown tool: ${h.type} -->`;
|
|
1336
1379
|
const u = {
|
|
1337
|
-
columnWidth:
|
|
1380
|
+
columnWidth: e,
|
|
1338
1381
|
displayMode: "email",
|
|
1339
1382
|
contentWidth: parseInt(n.contentWidth || "600"),
|
|
1340
1383
|
bodyValues: n
|
|
1341
1384
|
};
|
|
1342
|
-
|
|
1385
|
+
let m = g(h.values, u);
|
|
1386
|
+
const x = !!h.values.hideDesktop, b = !!h.values.hideMobile;
|
|
1387
|
+
return (x || b) && (m = `<div class="${[x && "u_hide_desktop", b && "u_hide_mobile"].filter(Boolean).join(" ")}">${m}</div>`), m;
|
|
1343
1388
|
}).join(`
|
|
1344
1389
|
`);
|
|
1345
|
-
return `<div class="u_column" style="max-width:${
|
|
1346
|
-
<div style="height:100%;width:100% !important;border-radius:${
|
|
1347
|
-
<div style="box-sizing:border-box;height:100%;padding:${s};border:none;border-radius:${
|
|
1390
|
+
return `<div class="u_column" style="max-width:${e}px;min-width:${Math.min(e, 320)}px;display:table-cell;vertical-align:top;">
|
|
1391
|
+
<div style="height:100%;width:100% !important;border-radius:${l};-webkit-border-radius:${l};${d}">
|
|
1392
|
+
<div style="box-sizing:border-box;height:100%;padding:${s};border:none;border-radius:${l};-webkit-border-radius:${l};">
|
|
1348
1393
|
${p || '<!--[if (!mso)&(!IE)]><!--><div style="height:0;min-height:1px;font-size:0;"> </div><!--<![endif]-->'}
|
|
1349
1394
|
</div>
|
|
1350
1395
|
</div>
|
|
1351
1396
|
</div>`;
|
|
1352
1397
|
}
|
|
1353
|
-
function
|
|
1398
|
+
function It(t) {
|
|
1354
1399
|
return `
|
|
1355
|
-
@media only screen and (min-width: ${
|
|
1400
|
+
@media only screen and (min-width: ${t + 20}px) {
|
|
1356
1401
|
.u_row .u_column { display: table-cell; }
|
|
1357
1402
|
}
|
|
1358
1403
|
|
|
1359
|
-
@media only screen and (max-width: ${
|
|
1404
|
+
@media only screen and (max-width: ${t + 20}px) {
|
|
1360
1405
|
.u_row .u_column {
|
|
1361
1406
|
display: block !important;
|
|
1362
1407
|
width: 100% !important;
|
|
@@ -1390,27 +1435,27 @@ function Dt(e) {
|
|
|
1390
1435
|
.u_hide_desktop { display: block !important; }
|
|
1391
1436
|
.u_hide_mobile { display: block !important; }
|
|
1392
1437
|
|
|
1393
|
-
@media only screen and (max-width: ${
|
|
1438
|
+
@media only screen and (max-width: ${t + 20}px) {
|
|
1394
1439
|
.u_hide_desktop { display: block !important; }
|
|
1395
1440
|
.u_hide_mobile { display: none !important; }
|
|
1396
1441
|
}
|
|
1397
1442
|
|
|
1398
|
-
@media only screen and (min-width: ${
|
|
1443
|
+
@media only screen and (min-width: ${t + 21}px) {
|
|
1399
1444
|
.u_hide_desktop { display: none !important; }
|
|
1400
1445
|
.u_hide_mobile { display: block !important; }
|
|
1401
1446
|
}`;
|
|
1402
1447
|
}
|
|
1403
|
-
function
|
|
1404
|
-
const n =
|
|
1405
|
-
`), s =
|
|
1406
|
-
let
|
|
1448
|
+
function Tt(t, e, o) {
|
|
1449
|
+
const n = t.body.values, i = parseInt(n.contentWidth || "600"), r = t.body.rows.map((g) => Mt(g, n, e)).join(`
|
|
1450
|
+
`), s = It(i);
|
|
1451
|
+
let l = Rt(r, s, n);
|
|
1407
1452
|
if (o?.mergeTags)
|
|
1408
1453
|
for (const [g, u] of Object.entries(o.mergeTags))
|
|
1409
|
-
|
|
1410
|
-
const d =
|
|
1454
|
+
l = l.replaceAll(`{{${g}}}`, u);
|
|
1455
|
+
const d = l.match(/<body[^>]*>([\s\S]*)<\/body>/i), p = l.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), h = [];
|
|
1411
1456
|
return n.fontFamily?.url && h.push(n.fontFamily.url), {
|
|
1412
|
-
design: structuredClone(
|
|
1413
|
-
html:
|
|
1457
|
+
design: structuredClone(t),
|
|
1458
|
+
html: l,
|
|
1414
1459
|
chunks: {
|
|
1415
1460
|
body: d?.[1] ?? r,
|
|
1416
1461
|
css: p?.map((g) => g.replace(/<\/?style[^>]*>/gi, "")).join(`
|
|
@@ -1420,17 +1465,17 @@ function Rt(e, t, o) {
|
|
|
1420
1465
|
}
|
|
1421
1466
|
};
|
|
1422
1467
|
}
|
|
1423
|
-
class
|
|
1468
|
+
class S {
|
|
1424
1469
|
/**
|
|
1425
1470
|
* @param host - The Lit component that owns this controller
|
|
1426
1471
|
* @param channels - Which store channels to subscribe to
|
|
1427
1472
|
*/
|
|
1428
|
-
constructor(
|
|
1429
|
-
this.store = null, this.host =
|
|
1473
|
+
constructor(e, o) {
|
|
1474
|
+
this.store = null, this.host = e, this.channels = o, e.addController(this);
|
|
1430
1475
|
}
|
|
1431
1476
|
/** Set or change the store reference. Re-subscribes automatically. */
|
|
1432
|
-
setStore(
|
|
1433
|
-
this.store !==
|
|
1477
|
+
setStore(e) {
|
|
1478
|
+
this.store !== e && (this.unsub?.(), this.store = e, this.subscribe());
|
|
1434
1479
|
}
|
|
1435
1480
|
hostConnected() {
|
|
1436
1481
|
this.subscribe();
|
|
@@ -1444,27 +1489,27 @@ class R {
|
|
|
1444
1489
|
}));
|
|
1445
1490
|
}
|
|
1446
1491
|
}
|
|
1447
|
-
var
|
|
1448
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1449
|
-
(s =
|
|
1450
|
-
return n && i &&
|
|
1492
|
+
var Pt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, j = (t, e, o, n) => {
|
|
1493
|
+
for (var i = n > 1 ? void 0 : n ? Vt(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1494
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
1495
|
+
return n && i && Pt(e, o, i), i;
|
|
1451
1496
|
};
|
|
1452
|
-
let _ = class extends
|
|
1497
|
+
let _ = class extends v {
|
|
1453
1498
|
constructor() {
|
|
1454
|
-
super(...arguments), this.storeCtrl = new
|
|
1455
|
-
|
|
1499
|
+
super(...arguments), this.storeCtrl = new S(this, ["design", "selection", "hover", "viewMode"]), this._onDragStart = (t) => {
|
|
1500
|
+
t.dataTransfer.setData("application/maileditor-content", this.content.id), t.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", E.startContentDrag(this.content.id);
|
|
1456
1501
|
}, this._onDragEnd = () => {
|
|
1457
|
-
this.style.opacity = "1",
|
|
1502
|
+
this.style.opacity = "1", E.reset();
|
|
1458
1503
|
};
|
|
1459
1504
|
}
|
|
1460
|
-
set store(
|
|
1461
|
-
this.storeCtrl.setStore(
|
|
1505
|
+
set store(t) {
|
|
1506
|
+
this.storeCtrl.setStore(t);
|
|
1462
1507
|
}
|
|
1463
1508
|
get store() {
|
|
1464
1509
|
return this.storeCtrl.store;
|
|
1465
1510
|
}
|
|
1466
|
-
handleClick(
|
|
1467
|
-
|
|
1511
|
+
handleClick(t) {
|
|
1512
|
+
t.stopPropagation(), this.store.select(this.content.id);
|
|
1468
1513
|
}
|
|
1469
1514
|
handleMouseEnter() {
|
|
1470
1515
|
this.store.hover(this.content.id);
|
|
@@ -1472,11 +1517,11 @@ let _ = class extends w {
|
|
|
1472
1517
|
handleMouseLeave() {
|
|
1473
1518
|
this.store.hover(null);
|
|
1474
1519
|
}
|
|
1475
|
-
handleDelete(
|
|
1476
|
-
|
|
1520
|
+
handleDelete(t) {
|
|
1521
|
+
t.stopPropagation(), this.store.removeContent(this.content.id);
|
|
1477
1522
|
}
|
|
1478
|
-
handleDuplicate(
|
|
1479
|
-
|
|
1523
|
+
handleDuplicate(t) {
|
|
1524
|
+
t.stopPropagation(), this.store.duplicateContent(this.content.id);
|
|
1480
1525
|
}
|
|
1481
1526
|
connectedCallback() {
|
|
1482
1527
|
super.connectedCallback(), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragend", this._onDragEnd);
|
|
@@ -1486,30 +1531,31 @@ let _ = class extends w {
|
|
|
1486
1531
|
}
|
|
1487
1532
|
render() {
|
|
1488
1533
|
if (!this.store) return c``;
|
|
1489
|
-
const
|
|
1490
|
-
this.classList.toggle("selected",
|
|
1491
|
-
const
|
|
1492
|
-
if (!
|
|
1534
|
+
const t = this.store.selectedId === this.content.id, e = this.store.hoveredId === this.content.id, o = this.store.viewMode, n = !!this.content.values.hideDesktop, i = !!this.content.values.hideMobile, r = o === "desktop" && n || o === "mobile" && i;
|
|
1535
|
+
this.classList.toggle("selected", t), this.classList.toggle("hovered", e), this.classList.toggle("hidden-in-view", r), this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id;
|
|
1536
|
+
const s = this.toolRegistry.get(this.content.type);
|
|
1537
|
+
if (!s && this.toolRegistry.has(this.content.type))
|
|
1493
1538
|
return this.toolRegistry.ensureLoaded(this.content.type).then(() => this.requestUpdate()), c`<div style="padding:16px;text-align:center;color:#9ca3af;font-size:13px;font-family:sans-serif;">Loading ${this.content.type}...</div>`;
|
|
1494
|
-
const
|
|
1495
|
-
isSelected:
|
|
1496
|
-
isHovered:
|
|
1539
|
+
const l = s?.renderer.renderEditor(this.content.values, {
|
|
1540
|
+
isSelected: t,
|
|
1541
|
+
isHovered: e,
|
|
1497
1542
|
columnWidth: 600,
|
|
1498
1543
|
displayMode: "email"
|
|
1499
1544
|
});
|
|
1500
1545
|
return c`
|
|
1546
|
+
${r ? c`<div class="hidden-badge">${n ? "Hidden on desktop" : i ? "Hidden on mobile" : ""}</div>` : ""}
|
|
1501
1547
|
<div class="action-bar">
|
|
1502
1548
|
<button class="action-btn" @click=${this.handleDuplicate} title="Duplicate">♻</button>
|
|
1503
1549
|
<button class="action-btn" @click=${this.handleDelete} title="Delete">✕</button>
|
|
1504
1550
|
</div>
|
|
1505
1551
|
<div class="content-wrapper" @click=${this.handleClick}
|
|
1506
1552
|
@mouseenter=${this.handleMouseEnter} @mouseleave=${this.handleMouseLeave}>
|
|
1507
|
-
${
|
|
1553
|
+
${l ?? c`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
|
|
1508
1554
|
</div>
|
|
1509
1555
|
`;
|
|
1510
1556
|
}
|
|
1511
1557
|
};
|
|
1512
|
-
_.styles =
|
|
1558
|
+
_.styles = $`
|
|
1513
1559
|
:host {
|
|
1514
1560
|
display: block; position: relative; cursor: pointer;
|
|
1515
1561
|
transition: outline 0.15s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
|
|
@@ -1519,6 +1565,16 @@ _.styles = v`
|
|
|
1519
1565
|
:host(.just-dropped) {
|
|
1520
1566
|
animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
1521
1567
|
}
|
|
1568
|
+
:host(.hidden-in-view) {
|
|
1569
|
+
opacity: 0.3;
|
|
1570
|
+
position: relative;
|
|
1571
|
+
}
|
|
1572
|
+
.hidden-badge {
|
|
1573
|
+
position: absolute; top: 4px; right: 4px; z-index: 5;
|
|
1574
|
+
background: #f59e0b; color: white; font-size: 10px; font-weight: 600;
|
|
1575
|
+
padding: 2px 6px; border-radius: 3px; font-family: sans-serif;
|
|
1576
|
+
pointer-events: none;
|
|
1577
|
+
}
|
|
1522
1578
|
@keyframes dropIn {
|
|
1523
1579
|
0% { opacity: 0; transform: scale(0.92) translateY(-8px); }
|
|
1524
1580
|
100% { opacity: 1; transform: scale(1) translateY(0); }
|
|
@@ -1536,35 +1592,35 @@ _.styles = v`
|
|
|
1536
1592
|
.content-wrapper { position: relative; }
|
|
1537
1593
|
`;
|
|
1538
1594
|
j([
|
|
1539
|
-
|
|
1595
|
+
f({ attribute: !1 })
|
|
1540
1596
|
], _.prototype, "content", 2);
|
|
1541
1597
|
j([
|
|
1542
|
-
|
|
1598
|
+
f({ attribute: !1 })
|
|
1543
1599
|
], _.prototype, "store", 1);
|
|
1544
1600
|
j([
|
|
1545
|
-
|
|
1601
|
+
f({ attribute: !1 })
|
|
1546
1602
|
], _.prototype, "toolRegistry", 2);
|
|
1547
1603
|
_ = j([
|
|
1548
|
-
|
|
1604
|
+
k("me-content-renderer")
|
|
1549
1605
|
], _);
|
|
1550
|
-
var
|
|
1551
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1552
|
-
(s =
|
|
1553
|
-
return n && i &&
|
|
1606
|
+
var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, B = (t, e, o, n) => {
|
|
1607
|
+
for (var i = n > 1 ? void 0 : n ? Et(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1608
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
1609
|
+
return n && i && zt(e, o, i), i;
|
|
1554
1610
|
};
|
|
1555
|
-
let
|
|
1611
|
+
let w = class extends v {
|
|
1556
1612
|
constructor() {
|
|
1557
|
-
super(...arguments), this.storeCtrl = new
|
|
1613
|
+
super(...arguments), this.storeCtrl = new S(this, ["design"]), this.widthPercent = 100;
|
|
1558
1614
|
}
|
|
1559
|
-
set store(
|
|
1560
|
-
this.storeCtrl.setStore(
|
|
1615
|
+
set store(t) {
|
|
1616
|
+
this.storeCtrl.setStore(t);
|
|
1561
1617
|
}
|
|
1562
1618
|
get store() {
|
|
1563
1619
|
return this.storeCtrl.store;
|
|
1564
1620
|
}
|
|
1565
1621
|
render() {
|
|
1566
|
-
const
|
|
1567
|
-
return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding =
|
|
1622
|
+
const t = this.column.values.padding || "0px", e = this.column.values.backgroundColor || "transparent", o = this.column.contents;
|
|
1623
|
+
return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding = t, this.style.backgroundColor = e, this.style.verticalAlign = "top", this.style.boxSizing = "border-box", o.length === 0 ? c`
|
|
1568
1624
|
<div class="empty-column" data-column-id=${this.column.id}>
|
|
1569
1625
|
Drag content here
|
|
1570
1626
|
</div>
|
|
@@ -1581,7 +1637,7 @@ let y = class extends w {
|
|
|
1581
1637
|
`;
|
|
1582
1638
|
}
|
|
1583
1639
|
};
|
|
1584
|
-
|
|
1640
|
+
w.styles = $`
|
|
1585
1641
|
:host {
|
|
1586
1642
|
display: block;
|
|
1587
1643
|
min-height: 40px;
|
|
@@ -1612,54 +1668,56 @@ y.styles = v`
|
|
|
1612
1668
|
}
|
|
1613
1669
|
`;
|
|
1614
1670
|
B([
|
|
1615
|
-
|
|
1616
|
-
],
|
|
1671
|
+
f({ attribute: !1 })
|
|
1672
|
+
], w.prototype, "column", 2);
|
|
1617
1673
|
B([
|
|
1618
|
-
|
|
1619
|
-
],
|
|
1674
|
+
f({ attribute: !1 })
|
|
1675
|
+
], w.prototype, "store", 1);
|
|
1620
1676
|
B([
|
|
1621
|
-
|
|
1622
|
-
],
|
|
1677
|
+
f({ attribute: !1 })
|
|
1678
|
+
], w.prototype, "toolRegistry", 2);
|
|
1623
1679
|
B([
|
|
1624
|
-
|
|
1625
|
-
],
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
],
|
|
1629
|
-
var
|
|
1630
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1631
|
-
(s =
|
|
1632
|
-
return n && i &&
|
|
1680
|
+
f({ type: Number })
|
|
1681
|
+
], w.prototype, "widthPercent", 2);
|
|
1682
|
+
w = B([
|
|
1683
|
+
k("me-column-renderer")
|
|
1684
|
+
], w);
|
|
1685
|
+
var Lt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, W = (t, e, o, n) => {
|
|
1686
|
+
for (var i = n > 1 ? void 0 : n ? At(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1687
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
1688
|
+
return n && i && Lt(e, o, i), i;
|
|
1633
1689
|
};
|
|
1634
|
-
let D = class extends
|
|
1690
|
+
let D = class extends v {
|
|
1635
1691
|
constructor() {
|
|
1636
|
-
super(...arguments), this.storeCtrl = new
|
|
1692
|
+
super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
|
|
1637
1693
|
}
|
|
1638
|
-
set store(
|
|
1639
|
-
this.storeCtrl.setStore(
|
|
1694
|
+
set store(t) {
|
|
1695
|
+
this.storeCtrl.setStore(t);
|
|
1640
1696
|
}
|
|
1641
1697
|
get store() {
|
|
1642
1698
|
return this.storeCtrl.store;
|
|
1643
1699
|
}
|
|
1644
|
-
handleMoveUp(
|
|
1645
|
-
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1700
|
+
handleMoveUp(t) {
|
|
1701
|
+
t.stopPropagation();
|
|
1702
|
+
const e = this.store.getRowIndex(this.row.id);
|
|
1703
|
+
e > 0 && this.store.moveRow(e, e - 1);
|
|
1648
1704
|
}
|
|
1649
|
-
handleMoveDown(
|
|
1650
|
-
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1705
|
+
handleMoveDown(t) {
|
|
1706
|
+
t.stopPropagation();
|
|
1707
|
+
const e = this.store.getRowIndex(this.row.id), o = this.store.getRows().length;
|
|
1708
|
+
e < o - 1 && this.store.moveRow(e, e + 1);
|
|
1653
1709
|
}
|
|
1654
|
-
handleDuplicate(
|
|
1655
|
-
|
|
1710
|
+
handleDuplicate(t) {
|
|
1711
|
+
t.stopPropagation(), this.store.duplicateRow(this.row.id);
|
|
1656
1712
|
}
|
|
1657
|
-
handleDelete(
|
|
1658
|
-
|
|
1713
|
+
handleDelete(t) {
|
|
1714
|
+
t.stopPropagation(), this.store.removeRow(this.row.id);
|
|
1659
1715
|
}
|
|
1660
1716
|
render() {
|
|
1661
|
-
|
|
1662
|
-
|
|
1717
|
+
if (!this.store) return c``;
|
|
1718
|
+
const { row: t, store: e, toolRegistry: o } = this, n = t.values.backgroundColor || "transparent", i = t.values.columnsBackgroundColor || "transparent", r = t.values.padding || "0px", s = t.cells.reduce((b, y) => b + y, 0), l = t.values.backgroundImage, d = typeof l == "object" && l?.url ? l.url : "", p = d ? `background-image:url('${d}');background-size:${l?.cover ? "cover" : "contain"};background-position:${l?.center ? "center" : "top left"};background-repeat:${l?.repeat ? "repeat" : "no-repeat"};` : "", h = e.viewMode, g = !!t.values.hideDesktop, u = !!t.values.hideMobile, m = h === "desktop" && g || h === "mobile" && u, x = g ? "Hidden on desktop" : u ? "Hidden on mobile" : "";
|
|
1719
|
+
return this.classList.toggle("hidden-in-view", m), this.setAttribute("draggable", "true"), this.dataset.rowId = t.id, c`
|
|
1720
|
+
${m ? c`<div class="row-hidden-badge">${x}</div>` : ""}
|
|
1663
1721
|
<div class="row-actions">
|
|
1664
1722
|
<button class="row-action-btn" @click=${this.handleMoveUp} title="Move Up">
|
|
1665
1723
|
<svg viewBox="0 0 24 24"><path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>
|
|
@@ -1676,16 +1734,16 @@ let D = class extends w {
|
|
|
1676
1734
|
</div>
|
|
1677
1735
|
<div
|
|
1678
1736
|
class="row-wrapper"
|
|
1679
|
-
style="background-color:${n};padding:${r}
|
|
1737
|
+
style="background-color:${n};padding:${r};${p}"
|
|
1680
1738
|
>
|
|
1681
|
-
${
|
|
1682
|
-
const
|
|
1739
|
+
${t.columns.map((b, y) => {
|
|
1740
|
+
const R = t.cells[y] / s * 100;
|
|
1683
1741
|
return c`
|
|
1684
1742
|
<me-column-renderer
|
|
1685
|
-
.column=${
|
|
1686
|
-
.store=${
|
|
1743
|
+
.column=${b}
|
|
1744
|
+
.store=${e}
|
|
1687
1745
|
.toolRegistry=${o}
|
|
1688
|
-
.widthPercent=${
|
|
1746
|
+
.widthPercent=${R}
|
|
1689
1747
|
style="background-color:${i};"
|
|
1690
1748
|
></me-column-renderer>
|
|
1691
1749
|
`;
|
|
@@ -1694,10 +1752,18 @@ let D = class extends w {
|
|
|
1694
1752
|
`;
|
|
1695
1753
|
}
|
|
1696
1754
|
};
|
|
1697
|
-
D.styles =
|
|
1755
|
+
D.styles = $`
|
|
1698
1756
|
:host {
|
|
1699
1757
|
display: block;
|
|
1700
1758
|
position: relative;
|
|
1759
|
+
transition: opacity 0.2s ease;
|
|
1760
|
+
}
|
|
1761
|
+
:host(.hidden-in-view) { opacity: 0.3; }
|
|
1762
|
+
.row-hidden-badge {
|
|
1763
|
+
position: absolute; top: 4px; left: 4px; z-index: 5;
|
|
1764
|
+
background: #f59e0b; color: white; font-size: 10px; font-weight: 600;
|
|
1765
|
+
padding: 2px 6px; border-radius: 3px; font-family: sans-serif;
|
|
1766
|
+
pointer-events: none;
|
|
1701
1767
|
}
|
|
1702
1768
|
.row-wrapper {
|
|
1703
1769
|
display: flex;
|
|
@@ -1751,28 +1817,28 @@ D.styles = v`
|
|
|
1751
1817
|
}
|
|
1752
1818
|
`;
|
|
1753
1819
|
W([
|
|
1754
|
-
|
|
1820
|
+
f({ attribute: !1 })
|
|
1755
1821
|
], D.prototype, "row", 2);
|
|
1756
1822
|
W([
|
|
1757
|
-
|
|
1823
|
+
f({ attribute: !1 })
|
|
1758
1824
|
], D.prototype, "store", 1);
|
|
1759
1825
|
W([
|
|
1760
|
-
|
|
1826
|
+
f({ attribute: !1 })
|
|
1761
1827
|
], D.prototype, "toolRegistry", 2);
|
|
1762
1828
|
D = W([
|
|
1763
|
-
|
|
1829
|
+
k("me-row-renderer")
|
|
1764
1830
|
], D);
|
|
1765
|
-
var
|
|
1766
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1767
|
-
(s =
|
|
1768
|
-
return n && i &&
|
|
1831
|
+
var Bt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, G = (t, e, o, n) => {
|
|
1832
|
+
for (var i = n > 1 ? void 0 : n ? Ht(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1833
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
1834
|
+
return n && i && Bt(e, o, i), i;
|
|
1769
1835
|
};
|
|
1770
|
-
let
|
|
1836
|
+
let I = class extends v {
|
|
1771
1837
|
constructor() {
|
|
1772
|
-
super(...arguments), this.storeCtrl = new
|
|
1838
|
+
super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
|
|
1773
1839
|
}
|
|
1774
|
-
set store(
|
|
1775
|
-
this.storeCtrl.setStore(
|
|
1840
|
+
set store(t) {
|
|
1841
|
+
this.storeCtrl.setStore(t);
|
|
1776
1842
|
}
|
|
1777
1843
|
get store() {
|
|
1778
1844
|
return this.storeCtrl.store;
|
|
@@ -1780,11 +1846,11 @@ let T = class extends w {
|
|
|
1780
1846
|
handleCanvasClick() {
|
|
1781
1847
|
this.store.select(null);
|
|
1782
1848
|
}
|
|
1783
|
-
setViewMode(
|
|
1784
|
-
this.store.setViewMode(
|
|
1849
|
+
setViewMode(t) {
|
|
1850
|
+
this.store.setViewMode(t);
|
|
1785
1851
|
}
|
|
1786
1852
|
render() {
|
|
1787
|
-
const
|
|
1853
|
+
const t = this.store.getRows(), e = this.store.getBodyValues(), o = e.contentWidth || "600px", n = e.backgroundColor || "#e7e7e7", i = this.store.viewMode;
|
|
1788
1854
|
return c`
|
|
1789
1855
|
<div class="view-toggle">
|
|
1790
1856
|
<button
|
|
@@ -1802,12 +1868,12 @@ let T = class extends w {
|
|
|
1802
1868
|
style="max-width:${i === "mobile" ? "375px" : o};background-color:${n};"
|
|
1803
1869
|
@click=${this.handleCanvasClick}
|
|
1804
1870
|
>
|
|
1805
|
-
${
|
|
1871
|
+
${t.length === 0 ? c`
|
|
1806
1872
|
<div class="empty-canvas">
|
|
1807
1873
|
<div class="empty-icon">☰</div>
|
|
1808
1874
|
<div>Drag a content block here</div>
|
|
1809
1875
|
</div>
|
|
1810
|
-
` :
|
|
1876
|
+
` : t.map(
|
|
1811
1877
|
(s) => c`
|
|
1812
1878
|
<me-row-renderer
|
|
1813
1879
|
.row=${s}
|
|
@@ -1820,7 +1886,7 @@ let T = class extends w {
|
|
|
1820
1886
|
`;
|
|
1821
1887
|
}
|
|
1822
1888
|
};
|
|
1823
|
-
|
|
1889
|
+
I.styles = $`
|
|
1824
1890
|
:host {
|
|
1825
1891
|
display: block;
|
|
1826
1892
|
flex: 1;
|
|
@@ -1875,20 +1941,20 @@ T.styles = v`
|
|
|
1875
1941
|
}
|
|
1876
1942
|
`;
|
|
1877
1943
|
G([
|
|
1878
|
-
|
|
1879
|
-
],
|
|
1944
|
+
f({ attribute: !1 })
|
|
1945
|
+
], I.prototype, "store", 1);
|
|
1880
1946
|
G([
|
|
1881
|
-
|
|
1882
|
-
],
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
],
|
|
1886
|
-
var
|
|
1887
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
1888
|
-
(s =
|
|
1889
|
-
return n && i &&
|
|
1947
|
+
f({ attribute: !1 })
|
|
1948
|
+
], I.prototype, "toolRegistry", 2);
|
|
1949
|
+
I = G([
|
|
1950
|
+
k("me-editor-canvas")
|
|
1951
|
+
], I);
|
|
1952
|
+
var Ot = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, rt = (t, e, o, n) => {
|
|
1953
|
+
for (var i = n > 1 ? void 0 : n ? jt(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1954
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
1955
|
+
return n && i && Ot(e, o, i), i;
|
|
1890
1956
|
};
|
|
1891
|
-
const
|
|
1957
|
+
const it = [
|
|
1892
1958
|
{ label: "Arial", value: "arial,helvetica,sans-serif" },
|
|
1893
1959
|
{ label: "Helvetica", value: "helvetica,sans-serif" },
|
|
1894
1960
|
{ label: "Georgia", value: "georgia,serif" },
|
|
@@ -1897,44 +1963,44 @@ const et = [
|
|
|
1897
1963
|
{ label: "Verdana", value: "verdana,geneva,sans-serif" },
|
|
1898
1964
|
{ label: "Courier New", value: "'courier new',courier,monospace" }
|
|
1899
1965
|
];
|
|
1900
|
-
let
|
|
1966
|
+
let L = class extends v {
|
|
1901
1967
|
constructor() {
|
|
1902
|
-
super(...arguments), this.storeCtrl = new
|
|
1968
|
+
super(...arguments), this.storeCtrl = new S(this, ["design"]);
|
|
1903
1969
|
}
|
|
1904
|
-
set store(
|
|
1905
|
-
this.storeCtrl.setStore(
|
|
1970
|
+
set store(t) {
|
|
1971
|
+
this.storeCtrl.setStore(t);
|
|
1906
1972
|
}
|
|
1907
1973
|
get store() {
|
|
1908
1974
|
return this.storeCtrl.store;
|
|
1909
1975
|
}
|
|
1910
|
-
update_(
|
|
1911
|
-
this.store.updateBodyValues({ [
|
|
1976
|
+
update_(t, e) {
|
|
1977
|
+
this.store.updateBodyValues({ [t]: e });
|
|
1912
1978
|
}
|
|
1913
|
-
updateLinkStyle(
|
|
1979
|
+
updateLinkStyle(t, e) {
|
|
1914
1980
|
const o = this.store.getBodyValues().linkStyle;
|
|
1915
|
-
this.store.updateBodyValues({ linkStyle: { ...o, [
|
|
1981
|
+
this.store.updateBodyValues({ linkStyle: { ...o, [t]: e } });
|
|
1916
1982
|
}
|
|
1917
|
-
updateFontFamily(
|
|
1918
|
-
const
|
|
1919
|
-
this.store.updateBodyValues({ fontFamily: { label:
|
|
1983
|
+
updateFontFamily(t) {
|
|
1984
|
+
const e = it.find((o) => o.value === t);
|
|
1985
|
+
this.store.updateBodyValues({ fontFamily: { label: e?.label || t, value: t } });
|
|
1920
1986
|
}
|
|
1921
1987
|
render() {
|
|
1922
|
-
const
|
|
1988
|
+
const t = this.store.getBodyValues();
|
|
1923
1989
|
return c`
|
|
1924
|
-
${this.renderColorField("Background Color",
|
|
1990
|
+
${this.renderColorField("Background Color", t.backgroundColor || "#e7e7e7", (e) => this.update_("backgroundColor", e))}
|
|
1925
1991
|
|
|
1926
1992
|
<p class="section-title" style="margin-top:16px;">Content</p>
|
|
1927
1993
|
<div class="field">
|
|
1928
1994
|
<label class="field-label">Content Width (px)</label>
|
|
1929
|
-
<input class="input" type="number" .value=${parseInt(
|
|
1930
|
-
@change=${(
|
|
1995
|
+
<input class="input" type="number" .value=${parseInt(t.contentWidth || "600")} min="320" max="960" step="10"
|
|
1996
|
+
@change=${(e) => this.update_("contentWidth", e.target.value + "px")} />
|
|
1931
1997
|
</div>
|
|
1932
1998
|
<div class="field">
|
|
1933
1999
|
<label class="field-label">Content Align</label>
|
|
1934
2000
|
<div class="align-group">
|
|
1935
|
-
${["left", "center", "right"].map((
|
|
1936
|
-
<button class="align-btn ${
|
|
1937
|
-
@click=${() => this.update_("contentAlign",
|
|
2001
|
+
${["left", "center", "right"].map((e) => c`
|
|
2002
|
+
<button class="align-btn ${t.contentAlign === e ? "active" : ""}"
|
|
2003
|
+
@click=${() => this.update_("contentAlign", e)}>${e}</button>
|
|
1938
2004
|
`)}
|
|
1939
2005
|
</div>
|
|
1940
2006
|
</div>
|
|
@@ -1942,18 +2008,18 @@ let E = class extends w {
|
|
|
1942
2008
|
<p class="section-title" style="margin-top:16px;">Typography</p>
|
|
1943
2009
|
<div class="field">
|
|
1944
2010
|
<label class="field-label">Font Family</label>
|
|
1945
|
-
<select class="input" @change=${(
|
|
1946
|
-
${
|
|
2011
|
+
<select class="input" @change=${(e) => this.updateFontFamily(e.target.value)}>
|
|
2012
|
+
${it.map((e) => c`<option value=${e.value} ?selected=${t.fontFamily?.value === e.value}>${e.label}</option>`)}
|
|
1947
2013
|
</select>
|
|
1948
2014
|
</div>
|
|
1949
|
-
${this.renderColorField("Text Color",
|
|
2015
|
+
${this.renderColorField("Text Color", t.textColor || "#000000", (e) => this.update_("textColor", e))}
|
|
1950
2016
|
|
|
1951
2017
|
<p class="section-title" style="margin-top:16px;">Links</p>
|
|
1952
|
-
${this.renderColorField("Link Color",
|
|
2018
|
+
${this.renderColorField("Link Color", t.linkStyle?.linkColor || "#0000ee", (e) => this.updateLinkStyle("linkColor", e))}
|
|
1953
2019
|
<div class="field">
|
|
1954
2020
|
<label style="display:flex;align-items:center;gap:8px;font-size:12px;color:#6b7280;cursor:pointer;">
|
|
1955
|
-
<input type="checkbox" .checked=${
|
|
1956
|
-
@change=${(
|
|
2021
|
+
<input type="checkbox" .checked=${t.linkStyle?.linkUnderline ?? !0}
|
|
2022
|
+
@change=${(e) => this.updateLinkStyle("linkUnderline", e.target.checked)} />
|
|
1957
2023
|
Underline Links
|
|
1958
2024
|
</label>
|
|
1959
2025
|
</div>
|
|
@@ -1961,26 +2027,26 @@ let E = class extends w {
|
|
|
1961
2027
|
<p class="section-title" style="margin-top:16px;">Email</p>
|
|
1962
2028
|
<div class="field">
|
|
1963
2029
|
<label class="field-label">Preheader Text</label>
|
|
1964
|
-
<textarea class="input" .value=${
|
|
2030
|
+
<textarea class="input" .value=${t.preheaderText || ""} placeholder="Preview text shown in inbox..."
|
|
1965
2031
|
style="min-height:60px;resize:vertical;font-family:inherit;"
|
|
1966
|
-
@change=${(
|
|
2032
|
+
@change=${(e) => this.update_("preheaderText", e.target.value)}></textarea>
|
|
1967
2033
|
</div>
|
|
1968
2034
|
`;
|
|
1969
2035
|
}
|
|
1970
2036
|
/** Reusable color field (swatch + hex input) */
|
|
1971
|
-
renderColorField(
|
|
2037
|
+
renderColorField(t, e, o) {
|
|
1972
2038
|
return c`
|
|
1973
2039
|
<div class="field">
|
|
1974
|
-
<label class="field-label">${
|
|
2040
|
+
<label class="field-label">${t}</label>
|
|
1975
2041
|
<div class="color-row">
|
|
1976
|
-
<input class="color-swatch" type="color" .value=${
|
|
1977
|
-
<input class="input" type="text" .value=${
|
|
2042
|
+
<input class="color-swatch" type="color" .value=${e} @input=${(n) => o(n.target.value)} />
|
|
2043
|
+
<input class="input" type="text" .value=${e} style="flex:1;" @change=${(n) => o(n.target.value)} />
|
|
1978
2044
|
</div>
|
|
1979
2045
|
</div>
|
|
1980
2046
|
`;
|
|
1981
2047
|
}
|
|
1982
2048
|
};
|
|
1983
|
-
|
|
2049
|
+
L.styles = $`
|
|
1984
2050
|
:host { display: block; }
|
|
1985
2051
|
.section-title {
|
|
1986
2052
|
font-size: 11px; font-weight: 600; text-transform: uppercase;
|
|
@@ -2005,66 +2071,66 @@ E.styles = v`
|
|
|
2005
2071
|
}
|
|
2006
2072
|
.align-btn.active { border-color: #3b82f6; background: #eff6ff; color: #3b82f6; }
|
|
2007
2073
|
`;
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
],
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
],
|
|
2014
|
-
var
|
|
2015
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
2016
|
-
(s =
|
|
2017
|
-
return n && i &&
|
|
2074
|
+
rt([
|
|
2075
|
+
f({ attribute: !1 })
|
|
2076
|
+
], L.prototype, "store", 1);
|
|
2077
|
+
L = rt([
|
|
2078
|
+
k("me-body-settings")
|
|
2079
|
+
], L);
|
|
2080
|
+
var Wt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Y = (t, e, o, n) => {
|
|
2081
|
+
for (var i = n > 1 ? void 0 : n ? Ut(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2082
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
2083
|
+
return n && i && Wt(e, o, i), i;
|
|
2018
2084
|
};
|
|
2019
|
-
let
|
|
2085
|
+
let T = class extends v {
|
|
2020
2086
|
constructor() {
|
|
2021
|
-
super(...arguments), this.storeCtrl = new
|
|
2087
|
+
super(...arguments), this.storeCtrl = new S(this, ["activeTab"]);
|
|
2022
2088
|
}
|
|
2023
|
-
set store(
|
|
2024
|
-
this.storeCtrl.setStore(
|
|
2089
|
+
set store(t) {
|
|
2090
|
+
this.storeCtrl.setStore(t);
|
|
2025
2091
|
}
|
|
2026
2092
|
get store() {
|
|
2027
2093
|
return this.storeCtrl.store;
|
|
2028
2094
|
}
|
|
2029
|
-
handleDragStart(
|
|
2030
|
-
|
|
2095
|
+
handleDragStart(t, e) {
|
|
2096
|
+
t.dataTransfer.setData("application/maileditor-tool", e), t.dataTransfer.effectAllowed = "copy";
|
|
2031
2097
|
}
|
|
2032
|
-
handleLayoutDragStart(
|
|
2033
|
-
|
|
2098
|
+
handleLayoutDragStart(t, e) {
|
|
2099
|
+
t.dataTransfer.setData("application/maileditor-layout", JSON.stringify(e)), t.dataTransfer.effectAllowed = "copy";
|
|
2034
2100
|
}
|
|
2035
|
-
addRowWithLayout(
|
|
2036
|
-
const
|
|
2037
|
-
this.store.addRow(
|
|
2101
|
+
addRowWithLayout(t) {
|
|
2102
|
+
const e = this.store.createRow(t);
|
|
2103
|
+
this.store.addRow(e);
|
|
2038
2104
|
}
|
|
2039
2105
|
render() {
|
|
2040
|
-
const
|
|
2106
|
+
const t = this.store.activeTab, e = this.toolRegistry.getAllMeta();
|
|
2041
2107
|
return c`
|
|
2042
2108
|
<div class="tabs">
|
|
2043
|
-
<button class="tab ${
|
|
2044
|
-
<button class="tab ${
|
|
2045
|
-
<button class="tab ${
|
|
2109
|
+
<button class="tab ${t === "content" ? "active" : ""}" @click=${() => this.store.setActiveTab("content")}>Content</button>
|
|
2110
|
+
<button class="tab ${t === "blocks" ? "active" : ""}" @click=${() => this.store.setActiveTab("blocks")}>Blocks</button>
|
|
2111
|
+
<button class="tab ${t === "body" ? "active" : ""}" @click=${() => this.store.setActiveTab("body")}>Body</button>
|
|
2046
2112
|
</div>
|
|
2047
2113
|
|
|
2048
2114
|
<div class="tab-content">
|
|
2049
|
-
${
|
|
2050
|
-
${
|
|
2051
|
-
${
|
|
2115
|
+
${t === "content" ? this.renderContentTab(e) : ""}
|
|
2116
|
+
${t === "blocks" ? this.renderBlocksTab() : ""}
|
|
2117
|
+
${t === "body" ? this.renderBodyTab() : ""}
|
|
2052
2118
|
</div>
|
|
2053
2119
|
`;
|
|
2054
2120
|
}
|
|
2055
|
-
renderContentTab(
|
|
2121
|
+
renderContentTab(t) {
|
|
2056
2122
|
return c`
|
|
2057
2123
|
<p class="section-title">Content</p>
|
|
2058
2124
|
<div class="tool-grid">
|
|
2059
|
-
${
|
|
2060
|
-
(
|
|
2125
|
+
${t.map(
|
|
2126
|
+
(e) => c`
|
|
2061
2127
|
<div
|
|
2062
2128
|
class="tool-item"
|
|
2063
2129
|
draggable="true"
|
|
2064
|
-
@dragstart=${(o) => this.handleDragStart(o,
|
|
2130
|
+
@dragstart=${(o) => this.handleDragStart(o, e.name)}
|
|
2065
2131
|
>
|
|
2066
|
-
<div class="tool-icon">${q(
|
|
2067
|
-
<span>${
|
|
2132
|
+
<div class="tool-icon">${q(e.icon)}</div>
|
|
2133
|
+
<span>${e.label}</span>
|
|
2068
2134
|
</div>
|
|
2069
2135
|
`
|
|
2070
2136
|
)}
|
|
@@ -2081,17 +2147,17 @@ let I = class extends w {
|
|
|
2081
2147
|
</div>
|
|
2082
2148
|
`;
|
|
2083
2149
|
}
|
|
2084
|
-
renderLayoutOption(
|
|
2085
|
-
const o =
|
|
2150
|
+
renderLayoutOption(t, e) {
|
|
2151
|
+
const o = t.reduce((n, i) => n + i, 0);
|
|
2086
2152
|
return c`
|
|
2087
2153
|
<div
|
|
2088
2154
|
class="layout-item"
|
|
2089
2155
|
draggable="true"
|
|
2090
|
-
@click=${() => this.addRowWithLayout(
|
|
2091
|
-
@dragstart=${(n) => this.handleLayoutDragStart(n,
|
|
2092
|
-
title=${
|
|
2156
|
+
@click=${() => this.addRowWithLayout(t)}
|
|
2157
|
+
@dragstart=${(n) => this.handleLayoutDragStart(n, t)}
|
|
2158
|
+
title=${e}
|
|
2093
2159
|
>
|
|
2094
|
-
${
|
|
2160
|
+
${t.map(
|
|
2095
2161
|
(n) => c`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
|
|
2096
2162
|
)}
|
|
2097
2163
|
</div>
|
|
@@ -2108,7 +2174,7 @@ let I = class extends w {
|
|
|
2108
2174
|
return c`<me-body-settings .store=${this.store}></me-body-settings>`;
|
|
2109
2175
|
}
|
|
2110
2176
|
};
|
|
2111
|
-
|
|
2177
|
+
T.styles = $`
|
|
2112
2178
|
:host {
|
|
2113
2179
|
display: flex;
|
|
2114
2180
|
flex-direction: column;
|
|
@@ -2243,72 +2309,72 @@ I.styles = v`
|
|
|
2243
2309
|
}
|
|
2244
2310
|
`;
|
|
2245
2311
|
Y([
|
|
2246
|
-
|
|
2247
|
-
],
|
|
2312
|
+
f({ attribute: !1 })
|
|
2313
|
+
], T.prototype, "store", 1);
|
|
2248
2314
|
Y([
|
|
2249
|
-
|
|
2250
|
-
],
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
],
|
|
2254
|
-
function
|
|
2255
|
-
const n =
|
|
2315
|
+
f({ attribute: !1 })
|
|
2316
|
+
], T.prototype, "toolRegistry", 2);
|
|
2317
|
+
T = Y([
|
|
2318
|
+
k("me-editor-sidebar")
|
|
2319
|
+
], T);
|
|
2320
|
+
function Ft(t, e, o) {
|
|
2321
|
+
const n = t && /^#[0-9a-fA-F]{3,8}$/.test(t) ? t : "#000000";
|
|
2256
2322
|
return c`
|
|
2257
2323
|
<div class="prop-row">
|
|
2258
2324
|
<label class="prop-label">${o}</label>
|
|
2259
2325
|
<div class="prop-color">
|
|
2260
2326
|
<input class="color-swatch" type="color" .value=${n}
|
|
2261
|
-
@input=${(i) =>
|
|
2262
|
-
<input class="prop-input" type="text" .value=${
|
|
2263
|
-
@change=${(i) =>
|
|
2327
|
+
@input=${(i) => e(i.target.value)} />
|
|
2328
|
+
<input class="prop-input" type="text" .value=${t ?? ""} style="flex:1;"
|
|
2329
|
+
@change=${(i) => e(i.target.value)} />
|
|
2264
2330
|
</div>
|
|
2265
2331
|
</div>
|
|
2266
2332
|
`;
|
|
2267
2333
|
}
|
|
2268
|
-
function
|
|
2334
|
+
function Nt(t, e, o, n) {
|
|
2269
2335
|
const i = n?.options || [];
|
|
2270
2336
|
return c`
|
|
2271
2337
|
<div class="prop-row">
|
|
2272
2338
|
<label class="prop-label">${o}</label>
|
|
2273
|
-
<select class="prop-input" @change=${(r) =>
|
|
2274
|
-
${i.map((r) => c`<option value=${r.value} ?selected=${
|
|
2339
|
+
<select class="prop-input" @change=${(r) => e(r.target.value)}>
|
|
2340
|
+
${i.map((r) => c`<option value=${r.value} ?selected=${t === r.value}>${r.label}</option>`)}
|
|
2275
2341
|
</select>
|
|
2276
2342
|
</div>
|
|
2277
2343
|
`;
|
|
2278
2344
|
}
|
|
2279
|
-
function
|
|
2345
|
+
function qt(t, e, o) {
|
|
2280
2346
|
return c`
|
|
2281
2347
|
<div class="prop-row">
|
|
2282
2348
|
<label class="prop-label">${o}</label>
|
|
2283
2349
|
<div style="display:flex;gap:2px;">
|
|
2284
2350
|
${["left", "center", "right"].map((n) => c`
|
|
2285
2351
|
<button
|
|
2286
|
-
style="flex:1;padding:6px;border:1px solid ${
|
|
2287
|
-
@click=${() =>
|
|
2352
|
+
style="flex:1;padding:6px;border:1px solid ${t === n ? "#3b82f6" : "#d1d5db"};background:${t === n ? "#eff6ff" : "white"};border-radius:4px;cursor:pointer;font-size:11px;text-transform:capitalize;color:${t === n ? "#3b82f6" : "#6b7280"};"
|
|
2353
|
+
@click=${() => e(n)}
|
|
2288
2354
|
>${n}</button>
|
|
2289
2355
|
`)}
|
|
2290
2356
|
</div>
|
|
2291
2357
|
</div>
|
|
2292
2358
|
`;
|
|
2293
2359
|
}
|
|
2294
|
-
function
|
|
2295
|
-
const
|
|
2360
|
+
function Gt(t) {
|
|
2361
|
+
const e = (t || "0px").split(/\s+/).map((s) => parseInt(s) || 0), o = e[0], n = e[1] ?? o, i = e[2] ?? o, r = e[3] ?? n;
|
|
2296
2362
|
return [o, n, i, r];
|
|
2297
2363
|
}
|
|
2298
|
-
function
|
|
2299
|
-
return
|
|
2364
|
+
function Yt(t, e, o, n) {
|
|
2365
|
+
return t === e && e === o && o === n ? `${t}px` : t === o && e === n ? `${t}px ${e}px` : `${t}px ${e}px ${o}px ${n}px`;
|
|
2300
2366
|
}
|
|
2301
|
-
function
|
|
2302
|
-
const [n, i, r, s] =
|
|
2367
|
+
function Kt(t, e, o) {
|
|
2368
|
+
const [n, i, r, s] = Gt(t), l = (p, h, g, u) => e(Yt(p, h, g, u));
|
|
2303
2369
|
return c`
|
|
2304
2370
|
<div class="prop-row">
|
|
2305
2371
|
<label class="prop-label">${o}</label>
|
|
2306
2372
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;">
|
|
2307
2373
|
${[
|
|
2308
|
-
{ label: "T", val: n, change: (p) =>
|
|
2309
|
-
{ label: "R", val: i, change: (p) =>
|
|
2310
|
-
{ label: "B", val: r, change: (p) =>
|
|
2311
|
-
{ label: "L", val: s, change: (p) =>
|
|
2374
|
+
{ label: "T", val: n, change: (p) => l(p, i, r, s) },
|
|
2375
|
+
{ label: "R", val: i, change: (p) => l(n, p, r, s) },
|
|
2376
|
+
{ label: "B", val: r, change: (p) => l(n, i, p, s) },
|
|
2377
|
+
{ label: "L", val: s, change: (p) => l(n, i, r, p) }
|
|
2312
2378
|
].map((p) => c`
|
|
2313
2379
|
<div style="display:flex;align-items:center;gap:4px;">
|
|
2314
2380
|
<span style="font-size:10px;color:#9ca3af;width:12px;">${p.label}</span>
|
|
@@ -2321,110 +2387,110 @@ function Nt(e, t, o) {
|
|
|
2321
2387
|
</div>
|
|
2322
2388
|
`;
|
|
2323
2389
|
}
|
|
2324
|
-
function
|
|
2390
|
+
function Jt(t, e, o) {
|
|
2325
2391
|
return c`
|
|
2326
2392
|
<div class="prop-row">
|
|
2327
2393
|
<div class="prop-toggle">
|
|
2328
|
-
<input type="checkbox" .checked=${!!
|
|
2329
|
-
@change=${(n) =>
|
|
2394
|
+
<input type="checkbox" .checked=${!!t}
|
|
2395
|
+
@change=${(n) => e(n.target.checked)} />
|
|
2330
2396
|
<label class="prop-label" style="margin:0;">${o}</label>
|
|
2331
2397
|
</div>
|
|
2332
2398
|
</div>
|
|
2333
2399
|
`;
|
|
2334
2400
|
}
|
|
2335
|
-
function
|
|
2401
|
+
function Xt(t, e, o) {
|
|
2336
2402
|
return c`
|
|
2337
2403
|
<div class="prop-row">
|
|
2338
2404
|
<label class="prop-label">${o}</label>
|
|
2339
|
-
<input class="prop-input" type="text" .value=${
|
|
2340
|
-
@change=${(n) =>
|
|
2405
|
+
<input class="prop-input" type="text" .value=${t ?? ""}
|
|
2406
|
+
@change=${(n) => e(n.target.value)} />
|
|
2341
2407
|
</div>
|
|
2342
2408
|
`;
|
|
2343
2409
|
}
|
|
2344
|
-
function
|
|
2410
|
+
function Qt(t, e, o) {
|
|
2345
2411
|
return c`
|
|
2346
2412
|
<div class="prop-row">
|
|
2347
2413
|
<label class="prop-label">${o}</label>
|
|
2348
2414
|
<textarea class="prop-input"
|
|
2349
2415
|
style="min-height:100px;font-family:'SF Mono',Menlo,monospace;font-size:12px;"
|
|
2350
|
-
.value=${
|
|
2351
|
-
@change=${(n) =>
|
|
2416
|
+
.value=${t ?? ""}
|
|
2417
|
+
@change=${(n) => e(n.target.value)}
|
|
2352
2418
|
></textarea>
|
|
2353
2419
|
</div>
|
|
2354
2420
|
`;
|
|
2355
2421
|
}
|
|
2356
|
-
var
|
|
2357
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
2358
|
-
(s =
|
|
2359
|
-
return n && i &&
|
|
2422
|
+
var Zt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, K = (t, e, o, n) => {
|
|
2423
|
+
for (var i = n > 1 ? void 0 : n ? te(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2424
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
2425
|
+
return n && i && Zt(e, o, i), i;
|
|
2360
2426
|
};
|
|
2361
|
-
let P = class extends
|
|
2427
|
+
let P = class extends v {
|
|
2362
2428
|
constructor() {
|
|
2363
|
-
super(...arguments), this.storeCtrl = new
|
|
2429
|
+
super(...arguments), this.storeCtrl = new S(this, ["design", "selection"]);
|
|
2364
2430
|
}
|
|
2365
|
-
set store(
|
|
2366
|
-
this.storeCtrl.setStore(
|
|
2431
|
+
set store(t) {
|
|
2432
|
+
this.storeCtrl.setStore(t);
|
|
2367
2433
|
}
|
|
2368
2434
|
get store() {
|
|
2369
2435
|
return this.storeCtrl.store;
|
|
2370
2436
|
}
|
|
2371
2437
|
/** Create a change handler bound to a specific content ID and property key */
|
|
2372
|
-
onChange(
|
|
2438
|
+
onChange(t, e) {
|
|
2373
2439
|
return (o) => {
|
|
2374
|
-
this.store.updateContentValues(
|
|
2440
|
+
this.store.updateContentValues(t, { [e]: o });
|
|
2375
2441
|
};
|
|
2376
2442
|
}
|
|
2377
2443
|
render() {
|
|
2378
|
-
const
|
|
2379
|
-
if (!e)
|
|
2380
|
-
return c`<div class="no-selection">Select an element to edit its properties</div>`;
|
|
2381
|
-
const t = this.store.findContent(e);
|
|
2444
|
+
const t = this.store.selectedId;
|
|
2382
2445
|
if (!t)
|
|
2383
2446
|
return c`<div class="no-selection">Select an element to edit its properties</div>`;
|
|
2384
|
-
const
|
|
2447
|
+
const e = this.store.findContent(t);
|
|
2448
|
+
if (!e)
|
|
2449
|
+
return c`<div class="no-selection">Select an element to edit its properties</div>`;
|
|
2450
|
+
const o = this.toolRegistry.get(e.type);
|
|
2385
2451
|
return o ? c`
|
|
2386
2452
|
<div class="header">
|
|
2387
2453
|
<p class="header-title">${o.label}</p>
|
|
2388
|
-
<p class="header-type">${
|
|
2454
|
+
<p class="header-type">${e.type}</p>
|
|
2389
2455
|
</div>
|
|
2390
|
-
${Object.entries(o.options).map(([, n]) => this.renderGroup(
|
|
2391
|
-
` : c`<div class="no-selection">Unknown tool: ${
|
|
2456
|
+
${Object.entries(o.options).map(([, n]) => this.renderGroup(e, n))}
|
|
2457
|
+
` : c`<div class="no-selection">Unknown tool: ${e.type}</div>`;
|
|
2392
2458
|
}
|
|
2393
|
-
renderGroup(
|
|
2459
|
+
renderGroup(t, e) {
|
|
2394
2460
|
return c`
|
|
2395
2461
|
<div class="group">
|
|
2396
|
-
<div class="group-title">${
|
|
2462
|
+
<div class="group-title">${e.title}</div>
|
|
2397
2463
|
<div class="group-body">
|
|
2398
|
-
${Object.entries(
|
|
2399
|
-
([o, n]) => this.renderWidget(
|
|
2464
|
+
${Object.entries(e.options).map(
|
|
2465
|
+
([o, n]) => this.renderWidget(t, o, n)
|
|
2400
2466
|
)}
|
|
2401
2467
|
</div>
|
|
2402
2468
|
</div>
|
|
2403
2469
|
`;
|
|
2404
2470
|
}
|
|
2405
2471
|
/** Delegate to the correct widget function based on the property's widget type */
|
|
2406
|
-
renderWidget(
|
|
2407
|
-
const n =
|
|
2472
|
+
renderWidget(t, e, o) {
|
|
2473
|
+
const n = t.values[e] ?? o.defaultValue, i = this.onChange(t.id, e);
|
|
2408
2474
|
switch (o.widget) {
|
|
2409
2475
|
case "color_picker":
|
|
2410
|
-
return
|
|
2476
|
+
return Ft(n, i, o.label);
|
|
2411
2477
|
case "toggle":
|
|
2412
|
-
return
|
|
2478
|
+
return Jt(n, i, o.label);
|
|
2413
2479
|
case "rich_text":
|
|
2414
|
-
return
|
|
2480
|
+
return Qt(n, i, o.label);
|
|
2415
2481
|
case "dropdown":
|
|
2416
|
-
return
|
|
2482
|
+
return Nt(n, i, o.label, o.widgetParams);
|
|
2417
2483
|
case "alignment":
|
|
2418
|
-
return
|
|
2484
|
+
return qt(n, i, o.label);
|
|
2419
2485
|
case "padding":
|
|
2420
|
-
return
|
|
2486
|
+
return Kt(n, i, o.label);
|
|
2421
2487
|
case "text":
|
|
2422
2488
|
default:
|
|
2423
|
-
return
|
|
2489
|
+
return Xt(n, i, o.label);
|
|
2424
2490
|
}
|
|
2425
2491
|
}
|
|
2426
2492
|
};
|
|
2427
|
-
P.styles =
|
|
2493
|
+
P.styles = $`
|
|
2428
2494
|
:host {
|
|
2429
2495
|
display: flex; flex-direction: column; width: 300px; min-width: 300px;
|
|
2430
2496
|
background: #fff; border-left: 1px solid #e5e7eb;
|
|
@@ -2459,37 +2525,37 @@ P.styles = v`
|
|
|
2459
2525
|
textarea.prop-input { min-height: 80px; resize: vertical; font-family: monospace; }
|
|
2460
2526
|
`;
|
|
2461
2527
|
K([
|
|
2462
|
-
|
|
2528
|
+
f({ attribute: !1 })
|
|
2463
2529
|
], P.prototype, "store", 1);
|
|
2464
2530
|
K([
|
|
2465
|
-
|
|
2531
|
+
f({ attribute: !1 })
|
|
2466
2532
|
], P.prototype, "toolRegistry", 2);
|
|
2467
2533
|
P = K([
|
|
2468
|
-
|
|
2534
|
+
k("me-property-panel")
|
|
2469
2535
|
], P);
|
|
2470
|
-
var
|
|
2471
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
2472
|
-
(s =
|
|
2473
|
-
return n && i &&
|
|
2536
|
+
var ee = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, st = (t, e, o, n) => {
|
|
2537
|
+
for (var i = n > 1 ? void 0 : n ? oe(e, o) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2538
|
+
(s = t[r]) && (i = (n ? s(e, o, i) : s(i)) || i);
|
|
2539
|
+
return n && i && ee(e, o, i), i;
|
|
2474
2540
|
};
|
|
2475
|
-
let
|
|
2541
|
+
let A = class extends v {
|
|
2476
2542
|
constructor() {
|
|
2477
|
-
super(...arguments), this.options = {}, this.store = new
|
|
2478
|
-
const
|
|
2543
|
+
super(...arguments), this.options = {}, this.store = new ft(), this.toolRegistry = new mt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (t) => {
|
|
2544
|
+
const e = t.metaKey || t.ctrlKey, n = t.composedPath().some((i) => {
|
|
2479
2545
|
const r = i?.tagName;
|
|
2480
2546
|
return r === "INPUT" || r === "TEXTAREA" || r === "SELECT";
|
|
2481
2547
|
});
|
|
2482
|
-
n && !
|
|
2548
|
+
n && !e || (e && t.key === "z" && !t.shiftKey ? (t.preventDefault(), this.store.undo()) : e && (t.key === "y" || t.key === "z" && t.shiftKey) ? (t.preventDefault(), this.store.redo()) : (t.key === "Delete" || t.key === "Backspace") && this.store.selectedId && !n ? (t.preventDefault(), this.store.removeContent(this.store.selectedId)) : t.key === "Escape" && this.store.select(null));
|
|
2483
2549
|
};
|
|
2484
2550
|
}
|
|
2485
2551
|
connectedCallback() {
|
|
2486
2552
|
super.connectedCallback(), this.registerBuiltInTools(), this.applyOptions(), this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this._handleKeydown);
|
|
2487
2553
|
}
|
|
2488
2554
|
firstUpdated() {
|
|
2489
|
-
this.dragManager = new
|
|
2490
|
-
this.dispatchEvent(new CustomEvent("design:loaded", { detail:
|
|
2491
|
-
}), this.store.events.on("design:updated", (
|
|
2492
|
-
this.dispatchEvent(new CustomEvent("design:updated", { detail:
|
|
2555
|
+
this.dragManager = new xt(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (t) => {
|
|
2556
|
+
this.dispatchEvent(new CustomEvent("design:loaded", { detail: t, bubbles: !0, composed: !0 }));
|
|
2557
|
+
}), this.store.events.on("design:updated", (t) => {
|
|
2558
|
+
this.dispatchEvent(new CustomEvent("design:updated", { detail: t, bubbles: !0, composed: !0 }));
|
|
2493
2559
|
}), this.dispatchEvent(new CustomEvent("editor:ready", { bubbles: !0, composed: !0 })), this.preloadLazyTools();
|
|
2494
2560
|
}
|
|
2495
2561
|
disconnectedCallback() {
|
|
@@ -2498,41 +2564,41 @@ let L = class extends w {
|
|
|
2498
2564
|
// ----------------------------------------------------------
|
|
2499
2565
|
// Public API — public API
|
|
2500
2566
|
// ----------------------------------------------------------
|
|
2501
|
-
loadDesign(
|
|
2502
|
-
this.store.loadDesign(
|
|
2567
|
+
loadDesign(t) {
|
|
2568
|
+
this.store.loadDesign(t);
|
|
2503
2569
|
}
|
|
2504
|
-
saveDesign(
|
|
2505
|
-
|
|
2570
|
+
saveDesign(t) {
|
|
2571
|
+
t(structuredClone(this.store.getDesign()));
|
|
2506
2572
|
}
|
|
2507
|
-
exportHtml(
|
|
2573
|
+
exportHtml(t, e) {
|
|
2508
2574
|
const o = this.store.getDesign(), n = /* @__PURE__ */ new Set();
|
|
2509
2575
|
for (const r of o.body.rows)
|
|
2510
2576
|
for (const s of r.columns)
|
|
2511
|
-
for (const
|
|
2512
|
-
n.add(
|
|
2577
|
+
for (const l of s.contents)
|
|
2578
|
+
n.add(l.type);
|
|
2513
2579
|
const i = Array.from(n).filter((r) => !this.toolRegistry.isLoaded(r)).map((r) => this.toolRegistry.ensureLoaded(r));
|
|
2514
|
-
i.length > 0 ? Promise.all(i).then(() => this.doExport(o,
|
|
2580
|
+
i.length > 0 ? Promise.all(i).then(() => this.doExport(o, t, e)) : this.doExport(o, t, e);
|
|
2515
2581
|
}
|
|
2516
|
-
doExport(
|
|
2582
|
+
doExport(t, e, o) {
|
|
2517
2583
|
const n = /* @__PURE__ */ new Map();
|
|
2518
2584
|
for (const i of this.toolRegistry.getAll())
|
|
2519
2585
|
n.set(i.name, (r, s) => i.renderer.renderHtml(r, s));
|
|
2520
|
-
|
|
2586
|
+
e(Tt(t, n, o));
|
|
2521
2587
|
}
|
|
2522
|
-
async exportHtmlAsync(
|
|
2523
|
-
return new Promise((
|
|
2588
|
+
async exportHtmlAsync(t) {
|
|
2589
|
+
return new Promise((e) => this.exportHtml(e, t));
|
|
2524
2590
|
}
|
|
2525
|
-
registerTool(
|
|
2526
|
-
this.toolRegistry.register(
|
|
2591
|
+
registerTool(t) {
|
|
2592
|
+
this.toolRegistry.register(t), this.requestUpdate();
|
|
2527
2593
|
}
|
|
2528
|
-
registerPropertyEditor(
|
|
2594
|
+
registerPropertyEditor(t, e) {
|
|
2529
2595
|
}
|
|
2530
|
-
registerTab(
|
|
2596
|
+
registerTab(t) {
|
|
2531
2597
|
}
|
|
2532
|
-
registerCallback(
|
|
2533
|
-
this.callbacks.set(
|
|
2598
|
+
registerCallback(t, e) {
|
|
2599
|
+
this.callbacks.set(t, e);
|
|
2534
2600
|
}
|
|
2535
|
-
setMergeTags(
|
|
2601
|
+
setMergeTags(t) {
|
|
2536
2602
|
}
|
|
2537
2603
|
undo() {
|
|
2538
2604
|
this.store.undo();
|
|
@@ -2540,8 +2606,8 @@ let L = class extends w {
|
|
|
2540
2606
|
redo() {
|
|
2541
2607
|
this.store.redo();
|
|
2542
2608
|
}
|
|
2543
|
-
setBodyValues(
|
|
2544
|
-
this.store.updateBodyValues(
|
|
2609
|
+
setBodyValues(t) {
|
|
2610
|
+
this.store.updateBodyValues(t);
|
|
2545
2611
|
}
|
|
2546
2612
|
// ----------------------------------------------------------
|
|
2547
2613
|
// Internal
|
|
@@ -2552,17 +2618,17 @@ let L = class extends w {
|
|
|
2552
2618
|
* Falls back to setTimeout(1000) for browsers without idle callback support.
|
|
2553
2619
|
*/
|
|
2554
2620
|
preloadLazyTools() {
|
|
2555
|
-
const
|
|
2556
|
-
for (const { meta:
|
|
2557
|
-
|
|
2558
|
-
this.toolRegistry.ensureLoaded(
|
|
2621
|
+
const t = window.requestIdleCallback ?? ((e) => setTimeout(e, 1e3));
|
|
2622
|
+
for (const { meta: e } of ot)
|
|
2623
|
+
t(() => {
|
|
2624
|
+
this.toolRegistry.ensureLoaded(e.name);
|
|
2559
2625
|
});
|
|
2560
2626
|
}
|
|
2561
2627
|
registerBuiltInTools() {
|
|
2562
|
-
for (const
|
|
2563
|
-
this.toolRegistry.register(
|
|
2564
|
-
for (const { meta:
|
|
2565
|
-
this.toolRegistry.registerLazy(
|
|
2628
|
+
for (const t of St)
|
|
2629
|
+
this.toolRegistry.register(t);
|
|
2630
|
+
for (const { meta: t, loader: e } of ot)
|
|
2631
|
+
this.toolRegistry.registerLazy(t, e);
|
|
2566
2632
|
}
|
|
2567
2633
|
applyOptions() {
|
|
2568
2634
|
this.options.design && this.store.loadDesign(this.options.design);
|
|
@@ -2584,7 +2650,7 @@ let L = class extends w {
|
|
|
2584
2650
|
`;
|
|
2585
2651
|
}
|
|
2586
2652
|
};
|
|
2587
|
-
|
|
2653
|
+
A.styles = $`
|
|
2588
2654
|
:host {
|
|
2589
2655
|
display: flex;
|
|
2590
2656
|
width: 100%;
|
|
@@ -2599,31 +2665,31 @@ L.styles = v`
|
|
|
2599
2665
|
}
|
|
2600
2666
|
* { box-sizing: border-box; }
|
|
2601
2667
|
`;
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
],
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
],
|
|
2608
|
-
function
|
|
2609
|
-
customElements.get(
|
|
2668
|
+
st([
|
|
2669
|
+
f({ type: Object })
|
|
2670
|
+
], A.prototype, "options", 2);
|
|
2671
|
+
A = st([
|
|
2672
|
+
k("mail-editor")
|
|
2673
|
+
], A);
|
|
2674
|
+
function C(t, e) {
|
|
2675
|
+
customElements.get(t) || customElements.define(t, e);
|
|
2610
2676
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
const
|
|
2677
|
+
C("mail-editor", A);
|
|
2678
|
+
C("me-editor-canvas", I);
|
|
2679
|
+
C("me-row-renderer", D);
|
|
2680
|
+
C("me-column-renderer", w);
|
|
2681
|
+
C("me-content-renderer", _);
|
|
2682
|
+
C("me-editor-sidebar", T);
|
|
2683
|
+
C("me-body-settings", L);
|
|
2684
|
+
C("me-property-panel", P);
|
|
2685
|
+
const ae = customElements.get("mail-editor") !== void 0;
|
|
2620
2686
|
export {
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2687
|
+
ae as E,
|
|
2688
|
+
A as M,
|
|
2689
|
+
mt as T,
|
|
2690
|
+
ft as a,
|
|
2691
|
+
V as e,
|
|
2692
|
+
se as j,
|
|
2693
|
+
a as s
|
|
2628
2694
|
};
|
|
2629
|
-
//# sourceMappingURL=index-
|
|
2695
|
+
//# sourceMappingURL=index-CZt184D3.js.map
|