@emabuild/core 0.0.8 → 0.0.9
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/{form-tool-C9ccGMTE.js → form-tool-CxJstLJz.js} +2 -2
- package/dist/{form-tool-C9ccGMTE.js.map → form-tool-CxJstLJz.js.map} +1 -1
- package/dist/{html-tool-Dx0bJnRa.js → html-tool-Cqvglh05.js} +2 -2
- package/dist/{html-tool-Dx0bJnRa.js.map → html-tool-Cqvglh05.js.map} +1 -1
- package/dist/{mail-editor-D3QbvBKs.js → index-DV_tofKb.js} +1281 -221
- package/dist/index-DV_tofKb.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/{menu-tool-D34uGd81.js → menu-tool-ACBHeTTN.js} +2 -2
- package/dist/{menu-tool-D34uGd81.js.map → menu-tool-ACBHeTTN.js.map} +1 -1
- package/dist/register-elements.d.ts +6 -0
- package/dist/register-elements.d.ts.map +1 -0
- package/dist/{social-tool-_2fRc5-k.js → social-tool-MqaqWdRm.js} +2 -2
- package/dist/{social-tool-_2fRc5-k.js.map → social-tool-MqaqWdRm.js.map} +1 -1
- package/dist/{table-tool-B_MVWfF5.js → table-tool-AnVvJ0rV.js} +2 -2
- package/dist/{table-tool-B_MVWfF5.js.map → table-tool-AnVvJ0rV.js.map} +1 -1
- package/dist/{timer-tool-BUl5TiH0.js → timer-tool-BxrGmF-W.js} +2 -2
- package/dist/{timer-tool-BUl5TiH0.js.map → timer-tool-BxrGmF-W.js.map} +1 -1
- package/dist/{video-tool-HOA8TCla.js → video-tool-8g1_UVbn.js} +2 -2
- package/dist/{video-tool-HOA8TCla.js.map → video-tool-8g1_UVbn.js.map} +1 -1
- package/package.json +3 -7
- package/dist/mail-editor-D3QbvBKs.js.map +0 -1
- package/dist/mail-editor.js +0 -7
- package/dist/mail-editor.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { html as
|
|
2
|
-
import { property as
|
|
3
|
-
import { unsafeHTML as
|
|
4
|
-
function
|
|
1
|
+
import { html as c, LitElement as w, css as v } from "lit";
|
|
2
|
+
import { property as b, customElement as $ } from "lit/decorators.js";
|
|
3
|
+
import { unsafeHTML as q } from "lit/directives/unsafe-html.js";
|
|
4
|
+
function rt() {
|
|
5
5
|
const e = {};
|
|
6
6
|
return {
|
|
7
7
|
getCounters() {
|
|
@@ -18,7 +18,7 @@ function U() {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class st {
|
|
22
22
|
constructor() {
|
|
23
23
|
this.listeners = /* @__PURE__ */ new Map();
|
|
24
24
|
}
|
|
@@ -45,7 +45,7 @@ class O {
|
|
|
45
45
|
t ? this.listeners.delete(t) : this.listeners.clear();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
class
|
|
48
|
+
class lt {
|
|
49
49
|
constructor(t = 50) {
|
|
50
50
|
this.undoStack = [], this.redoStack = [], this.maxHistory = t;
|
|
51
51
|
}
|
|
@@ -78,7 +78,7 @@ class N {
|
|
|
78
78
|
this.undoStack = [], this.redoStack = [];
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function at() {
|
|
82
82
|
return {
|
|
83
83
|
counters: { u_row: 0, u_column: 0 },
|
|
84
84
|
body: {
|
|
@@ -123,7 +123,7 @@ function F() {
|
|
|
123
123
|
schemaVersion: 16
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function dt(e, t) {
|
|
127
127
|
const o = e.next("u_row"), n = t.map(() => {
|
|
128
128
|
const i = e.next("u_column");
|
|
129
129
|
return {
|
|
@@ -156,7 +156,7 @@ function q(e, t) {
|
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function ct(e, t, o = {}) {
|
|
160
160
|
const n = e.next(`u_content_${t}`), i = `u_content_${t}_${n}`;
|
|
161
161
|
return {
|
|
162
162
|
id: i,
|
|
@@ -172,37 +172,37 @@ function G(e, t, o = {}) {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function U(e, t) {
|
|
176
176
|
return e.body.rows.find((o) => o.id === t);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function O(e, t) {
|
|
179
179
|
for (const o of e.body.rows) {
|
|
180
180
|
const n = o.columns.find((i) => i.id === t);
|
|
181
181
|
if (n) return n;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function H(e, t) {
|
|
185
185
|
for (const o of e.body.rows)
|
|
186
186
|
for (const n of o.columns) {
|
|
187
187
|
const i = n.contents.find((r) => r.id === t);
|
|
188
188
|
if (i) return i;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function pt(e, t) {
|
|
192
192
|
for (const o of e.body.rows)
|
|
193
193
|
for (const n of o.columns)
|
|
194
194
|
if (n.contents.some((i) => i.id === t)) return n;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function ht(e, t) {
|
|
197
197
|
for (const o of e.body.rows)
|
|
198
198
|
if (o.columns.some((n) => n.id === t)) return o;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function F(e, t) {
|
|
201
201
|
return e.body.rows.findIndex((o) => o.id === t);
|
|
202
202
|
}
|
|
203
|
-
class
|
|
203
|
+
class ut {
|
|
204
204
|
constructor() {
|
|
205
|
-
this.history = new
|
|
205
|
+
this.history = new lt(), this.counterManager = rt(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new st(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = at();
|
|
206
206
|
}
|
|
207
207
|
// ── Subscriptions ──────────────────────────────────────────
|
|
208
208
|
/** Subscribe to ALL state changes (legacy). Returns an unsubscribe function. */
|
|
@@ -312,7 +312,7 @@ class X {
|
|
|
312
312
|
}
|
|
313
313
|
/** Remove a row by ID */
|
|
314
314
|
removeRow(t) {
|
|
315
|
-
const o =
|
|
315
|
+
const o = F(this.design, t);
|
|
316
316
|
o !== -1 && (this.history.push(this.design), this.design.body.rows.splice(o, 1), this._selectedId === t && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("row_removed"));
|
|
317
317
|
}
|
|
318
318
|
/** Move a row from one index to another */
|
|
@@ -323,41 +323,41 @@ class X {
|
|
|
323
323
|
}
|
|
324
324
|
/** Duplicate a row, assigning fresh IDs to all nested elements */
|
|
325
325
|
duplicateRow(t) {
|
|
326
|
-
const o =
|
|
326
|
+
const o = U(this.design, t);
|
|
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
|
-
for (const
|
|
331
|
+
for (const s of n.columns) {
|
|
332
332
|
const a = this.counterManager.next("u_column");
|
|
333
|
-
|
|
334
|
-
for (const d of
|
|
335
|
-
const
|
|
336
|
-
d.id = `u_content_${d.type}_${
|
|
333
|
+
s.id = `u_column_${a}`, s.values._meta = { htmlID: s.id, htmlClassNames: "u_column" };
|
|
334
|
+
for (const d of s.contents) {
|
|
335
|
+
const p = this.counterManager.next(`u_content_${d.type}`);
|
|
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 =
|
|
339
|
+
const r = F(this.design, t);
|
|
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
343
|
getRowIndex(t) {
|
|
344
|
-
return
|
|
344
|
+
return F(this.design, t);
|
|
345
345
|
}
|
|
346
346
|
/** Update row-level values */
|
|
347
347
|
updateRowValues(t, o) {
|
|
348
|
-
const n =
|
|
348
|
+
const n = U(this.design, t);
|
|
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
353
|
updateColumnValues(t, o) {
|
|
354
|
-
const n =
|
|
354
|
+
const n = O(this.design, t);
|
|
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
359
|
addContent(t, o, n) {
|
|
360
|
-
const i =
|
|
360
|
+
const i = O(this.design, t);
|
|
361
361
|
if (!i) return;
|
|
362
362
|
this.history.push(this.design);
|
|
363
363
|
const r = structuredClone(o);
|
|
@@ -376,36 +376,36 @@ class X {
|
|
|
376
376
|
}
|
|
377
377
|
/** Update content values by ID */
|
|
378
378
|
updateContentValues(t, o) {
|
|
379
|
-
const n =
|
|
379
|
+
const n = H(this.design, t);
|
|
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
383
|
moveContent(t, o, n) {
|
|
384
|
-
const i =
|
|
384
|
+
const i = H(this.design, t);
|
|
385
385
|
if (!i) return;
|
|
386
386
|
this.history.push(this.design);
|
|
387
|
-
for (const
|
|
388
|
-
for (const a of
|
|
389
|
-
const d = a.contents.findIndex((
|
|
387
|
+
for (const s of this.design.body.rows)
|
|
388
|
+
for (const a of s.columns) {
|
|
389
|
+
const d = a.contents.findIndex((p) => p.id === t);
|
|
390
390
|
if (d !== -1) {
|
|
391
391
|
a.contents.splice(d, 1);
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
const r =
|
|
395
|
+
const r = O(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
399
|
duplicateContent(t) {
|
|
400
|
-
const o =
|
|
400
|
+
const o = H(this.design, t);
|
|
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((
|
|
404
|
+
const r = i.contents.findIndex((s) => s.id === t);
|
|
405
405
|
if (r !== -1) {
|
|
406
406
|
this.history.push(this.design);
|
|
407
|
-
const
|
|
408
|
-
|
|
407
|
+
const s = structuredClone(o), a = this.counterManager.next(`u_content_${o.type}`);
|
|
408
|
+
s.id = `u_content_${o.type}_${a}`, 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
|
}
|
|
@@ -417,29 +417,29 @@ class X {
|
|
|
417
417
|
}
|
|
418
418
|
// ── Lookups (delegate to design-lookup) ────────────────────
|
|
419
419
|
findRow(t) {
|
|
420
|
-
return
|
|
420
|
+
return U(this.design, t);
|
|
421
421
|
}
|
|
422
422
|
findColumn(t) {
|
|
423
|
-
return
|
|
423
|
+
return O(this.design, t);
|
|
424
424
|
}
|
|
425
425
|
findContent(t) {
|
|
426
|
-
return
|
|
426
|
+
return H(this.design, t);
|
|
427
427
|
}
|
|
428
428
|
findParentColumn(t) {
|
|
429
|
-
return
|
|
429
|
+
return pt(this.design, t);
|
|
430
430
|
}
|
|
431
431
|
findParentRow(t) {
|
|
432
|
-
return
|
|
432
|
+
return ht(this.design, t);
|
|
433
433
|
}
|
|
434
434
|
// ── Factory Methods (delegate to design-factory) ───────────
|
|
435
435
|
/** Create a new row with the given column layout */
|
|
436
436
|
createRow(t) {
|
|
437
|
-
const o =
|
|
437
|
+
const o = dt(this.counterManager, t);
|
|
438
438
|
return this.syncCounters(), o;
|
|
439
439
|
}
|
|
440
440
|
/** Create a new content block for the given tool type */
|
|
441
441
|
createContent(t, o = {}) {
|
|
442
|
-
const n =
|
|
442
|
+
const n = ct(this.counterManager, t, o);
|
|
443
443
|
return this.syncCounters(), n;
|
|
444
444
|
}
|
|
445
445
|
// ── Private Helpers ────────────────────────────────────────
|
|
@@ -450,7 +450,7 @@ class X {
|
|
|
450
450
|
this.events.emit("design:updated", { type: t, item: o });
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
453
|
+
class gt {
|
|
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
|
}
|
|
@@ -526,8 +526,8 @@ class Y {
|
|
|
526
526
|
if (!o) return {};
|
|
527
527
|
const n = { ...o.defaultValues };
|
|
528
528
|
for (const i of Object.values(o.options))
|
|
529
|
-
for (const [r,
|
|
530
|
-
r in n || (n[r] =
|
|
529
|
+
for (const [r, s] of Object.entries(i.options))
|
|
530
|
+
r in n || (n[r] = s.defaultValue);
|
|
531
531
|
return n;
|
|
532
532
|
}
|
|
533
533
|
/** Get property groups for a tool */
|
|
@@ -535,7 +535,7 @@ class Y {
|
|
|
535
535
|
return this.tools.get(t)?.options ?? {};
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
const
|
|
538
|
+
const z = {
|
|
539
539
|
/** ID of the content currently being dragged (null if not dragging content) */
|
|
540
540
|
draggingContentId: null,
|
|
541
541
|
startContentDrag(e) {
|
|
@@ -545,7 +545,7 @@ const R = {
|
|
|
545
545
|
this.draggingContentId = null;
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
|
-
function
|
|
548
|
+
function J(e) {
|
|
549
549
|
const t = document.createElement("div");
|
|
550
550
|
return Object.assign(t.style, {
|
|
551
551
|
position: "absolute",
|
|
@@ -560,11 +560,11 @@ function T(e) {
|
|
|
560
560
|
boxShadow: `0 0 6px ${e}80`
|
|
561
561
|
}), t;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function X(e, t, o, n, i = "4px") {
|
|
564
564
|
e.parentNode !== t && (e.remove(), t.appendChild(e));
|
|
565
|
-
const
|
|
565
|
+
const s = (t instanceof ShadowRoot ? t.host : t).getBoundingClientRect();
|
|
566
566
|
let a;
|
|
567
|
-
o.length === 0 || n === 0 ? a = o.length === 0 ? 0 : o[0].getBoundingClientRect().top -
|
|
567
|
+
o.length === 0 || n === 0 ? a = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - s.top : n >= o.length ? a = o[o.length - 1].getBoundingClientRect().bottom - s.top : a = o[n].getBoundingClientRect().top - s.top, Object.assign(e.style, {
|
|
568
568
|
display: "block",
|
|
569
569
|
top: `${a}px`,
|
|
570
570
|
left: i,
|
|
@@ -572,32 +572,32 @@ function M(e, t, o, n, i = "4px") {
|
|
|
572
572
|
width: "auto"
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function S(e) {
|
|
576
576
|
e && (e.style.display = "none");
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function N(e, t) {
|
|
579
579
|
const o = (e instanceof ShadowRoot, e.children);
|
|
580
580
|
for (const n of Array.from(o)) {
|
|
581
581
|
const i = n;
|
|
582
|
-
t(i), i.shadowRoot &&
|
|
582
|
+
t(i), i.shadowRoot && N(i.shadowRoot, t), i.children?.length && N(i, t);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function Q(e, t) {
|
|
586
586
|
const o = [];
|
|
587
|
-
return
|
|
587
|
+
return N(e, (n) => {
|
|
588
588
|
n.matches?.(t) && o.push(n);
|
|
589
589
|
}), o;
|
|
590
590
|
}
|
|
591
|
-
class
|
|
591
|
+
class bt {
|
|
592
592
|
constructor(t, o, n) {
|
|
593
593
|
this.currentDrop = null, this.contentIndicator = null, this.rowIndicator = null, this.onDragOver = (i) => {
|
|
594
|
-
const r = i.dataTransfer?.types || [],
|
|
595
|
-
!
|
|
594
|
+
const r = i.dataTransfer?.types || [], s = r.includes("application/maileditor-tool"), a = r.includes("application/maileditor-layout"), d = r.includes("application/maileditor-content") || !!z.draggingContentId;
|
|
595
|
+
!s && !d && !a || (i.preventDefault(), i.dataTransfer.dropEffect = s || a ? "copy" : "move", a ? (this.currentDrop = this.findRowDropTarget(i.clientY), S(this.contentIndicator), this.showRowIndicator()) : (this.currentDrop = this.findContentDropTarget(i.clientX, i.clientY), S(this.rowIndicator), this.showContentIndicator()));
|
|
596
596
|
}, this.onDrop = (i) => {
|
|
597
597
|
i.preventDefault(), this.hideAllIndicators();
|
|
598
|
-
const r = this.currentDrop,
|
|
599
|
-
if (
|
|
600
|
-
this.handleLayoutDrop(JSON.parse(
|
|
598
|
+
const r = this.currentDrop, s = i.dataTransfer?.getData("application/maileditor-layout");
|
|
599
|
+
if (s) {
|
|
600
|
+
this.handleLayoutDrop(JSON.parse(s), r), this.reset();
|
|
601
601
|
return;
|
|
602
602
|
}
|
|
603
603
|
const a = i.dataTransfer?.getData("application/maileditor-tool");
|
|
@@ -605,7 +605,7 @@ class Q {
|
|
|
605
605
|
this.handleToolDrop(a, 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") || z.draggingContentId;
|
|
609
609
|
d && this.handleContentDrop(d, r), this.reset();
|
|
610
610
|
}, this.onDragEnd = () => {
|
|
611
611
|
this.hideAllIndicators(), this.reset();
|
|
@@ -616,7 +616,7 @@ class Q {
|
|
|
616
616
|
}
|
|
617
617
|
/** Attach all drag event listeners to the shadow root */
|
|
618
618
|
attach() {
|
|
619
|
-
this.root.addEventListener("dragover", this.onDragOver), this.root.addEventListener("drop", this.onDrop), this.root.addEventListener("dragend", this.onDragEnd), this.root.addEventListener("dragleave", this.onDragLeave), this.contentIndicator =
|
|
619
|
+
this.root.addEventListener("dragover", this.onDragOver), this.root.addEventListener("drop", this.onDrop), this.root.addEventListener("dragend", this.onDragEnd), this.root.addEventListener("dragleave", this.onDragLeave), this.contentIndicator = J("#3b82f6"), this.rowIndicator = J("#8b5cf6");
|
|
620
620
|
}
|
|
621
621
|
/** Remove all event listeners and clean up indicators */
|
|
622
622
|
detach() {
|
|
@@ -648,32 +648,32 @@ class Q {
|
|
|
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
650
|
let i = Math.abs(t - n[0].getBoundingClientRect().top), r = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
|
|
651
|
-
for (let
|
|
652
|
-
const a = n[
|
|
653
|
-
d < i && (i = d, r = { type: "row", rowIndex:
|
|
651
|
+
for (let s = 0; s < n.length; s++) {
|
|
652
|
+
const a = n[s].getBoundingClientRect().bottom, d = Math.abs(t - a);
|
|
653
|
+
d < i && (i = d, r = { type: "row", rowIndex: s + 1, y: a });
|
|
654
654
|
}
|
|
655
655
|
return r;
|
|
656
656
|
}
|
|
657
657
|
findContentDropTarget(t, o) {
|
|
658
|
-
const n =
|
|
658
|
+
const n = Q(this.root, "me-column-renderer");
|
|
659
659
|
let i = null, r = 1 / 0;
|
|
660
|
-
for (const
|
|
661
|
-
const a =
|
|
662
|
-
if (!a || !
|
|
663
|
-
const d =
|
|
660
|
+
for (const s of n) {
|
|
661
|
+
const a = s.dataset.columnId;
|
|
662
|
+
if (!a || !s.shadowRoot) continue;
|
|
663
|
+
const d = s.getBoundingClientRect();
|
|
664
664
|
if (t < d.left || t > d.right) continue;
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
667
|
-
const
|
|
668
|
-
|
|
665
|
+
const p = Array.from(s.shadowRoot.querySelectorAll("me-content-renderer"));
|
|
666
|
+
if (p.length === 0) {
|
|
667
|
+
const u = Math.abs(o - (d.top + d.height / 2));
|
|
668
|
+
u < r && (r = u, i = { type: "content", columnId: a, contentIndex: 0, y: d.top + d.height / 2 });
|
|
669
669
|
continue;
|
|
670
670
|
}
|
|
671
|
-
const
|
|
672
|
-
let g = Math.abs(o -
|
|
673
|
-
g < r && (r = g, i = { type: "content", columnId: a, contentIndex: 0, y:
|
|
674
|
-
for (let
|
|
675
|
-
const
|
|
676
|
-
g = Math.abs(o -
|
|
671
|
+
const h = p[0].getBoundingClientRect().top;
|
|
672
|
+
let g = Math.abs(o - h);
|
|
673
|
+
g < r && (r = g, i = { type: "content", columnId: a, contentIndex: 0, y: h });
|
|
674
|
+
for (let u = 0; u < p.length; u++) {
|
|
675
|
+
const m = p[u].getBoundingClientRect(), x = p[u + 1]?.getBoundingClientRect(), f = x ? (m.bottom + x.top) / 2 : m.bottom;
|
|
676
|
+
g = Math.abs(o - f), g < r && (r = g, i = { type: "content", columnId: a, contentIndex: u + 1, y: f });
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
return i;
|
|
@@ -681,36 +681,36 @@ class Q {
|
|
|
681
681
|
// ── Indicator Positioning ──────────────────────────────────
|
|
682
682
|
showContentIndicator() {
|
|
683
683
|
if (!this.contentIndicator || !this.currentDrop?.columnId) {
|
|
684
|
-
|
|
684
|
+
S(this.contentIndicator);
|
|
685
685
|
return;
|
|
686
686
|
}
|
|
687
|
-
const o =
|
|
687
|
+
const o = Q(this.root, "me-column-renderer").find((i) => i.dataset.columnId === this.currentDrop.columnId);
|
|
688
688
|
if (!o?.shadowRoot) return;
|
|
689
689
|
const n = Array.from(o.shadowRoot.querySelectorAll("me-content-renderer"));
|
|
690
|
-
|
|
690
|
+
X(this.contentIndicator, o.shadowRoot, n, this.currentDrop.contentIndex ?? 0, "4px");
|
|
691
691
|
}
|
|
692
692
|
showRowIndicator() {
|
|
693
693
|
if (!this.rowIndicator || !this.currentDrop) {
|
|
694
|
-
|
|
694
|
+
S(this.rowIndicator);
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
697
|
const t = this.root.querySelector("me-editor-canvas"), o = t?.shadowRoot?.querySelector(".canvas-body");
|
|
698
698
|
if (!o) return;
|
|
699
699
|
const n = Array.from(t.shadowRoot.querySelectorAll("me-row-renderer"));
|
|
700
|
-
|
|
700
|
+
X(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
|
|
701
701
|
}
|
|
702
702
|
hideAllIndicators() {
|
|
703
|
-
|
|
703
|
+
S(this.contentIndicator), S(this.rowIndicator);
|
|
704
704
|
}
|
|
705
705
|
reset() {
|
|
706
|
-
this.currentDrop = null,
|
|
706
|
+
this.currentDrop = null, z.reset();
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function l(e, t, o = "") {
|
|
710
710
|
const n = e[t];
|
|
711
711
|
return typeof n == "string" && n !== "" ? n : o;
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function oe(e, t) {
|
|
714
714
|
if (typeof e != "string") return t;
|
|
715
715
|
try {
|
|
716
716
|
return JSON.parse(e);
|
|
@@ -718,7 +718,7 @@ function bt(e, t) {
|
|
|
718
718
|
return t;
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function M(e, t) {
|
|
722
722
|
const { padding: o, align: n = "left", extraTdStyle: i = "" } = t;
|
|
723
723
|
return `<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
|
|
724
724
|
<tbody><tr><td style="${`overflow-wrap:break-word;word-break:break-word;padding:${o};font-family:arial,helvetica,sans-serif;${i}`}" align="${n}">
|
|
@@ -726,18 +726,18 @@ function y(e, t) {
|
|
|
726
726
|
</td></tr></tbody>
|
|
727
727
|
</table>`;
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
const { bgColor: n, textColor: i, fontSize: r, fontWeight:
|
|
729
|
+
function ft(e, t, o) {
|
|
730
|
+
const { bgColor: n, textColor: i, fontSize: r, fontWeight: s, borderRadius: a } = o, d = parseInt(a) || 0;
|
|
731
731
|
if (d <= 0) return "";
|
|
732
|
-
const
|
|
732
|
+
const p = Math.round(d / 20 * 100);
|
|
733
733
|
return `<!--[if mso]>
|
|
734
|
-
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${t}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${
|
|
734
|
+
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${t}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${p}%" stroke="f" fillcolor="${n}">
|
|
735
735
|
<w:anchorlock/>
|
|
736
|
-
<center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${
|
|
736
|
+
<center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${s};">${e}</center>
|
|
737
737
|
</v:roundrect>
|
|
738
738
|
<![endif]-->`;
|
|
739
739
|
}
|
|
740
|
-
const
|
|
740
|
+
const mt = {
|
|
741
741
|
name: "text",
|
|
742
742
|
label: "Text",
|
|
743
743
|
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>',
|
|
@@ -800,19 +800,19 @@ const tt = {
|
|
|
800
800
|
},
|
|
801
801
|
renderer: {
|
|
802
802
|
renderEditor(e) {
|
|
803
|
-
const t =
|
|
804
|
-
return
|
|
803
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "transparent"), n = l(e, "color", "inherit"), i = l(e, "lineHeight", "140%"), r = l(e, "text");
|
|
804
|
+
return c`
|
|
805
805
|
<div style="padding:${t};background-color:${o};color:${n};line-height:${i};word-break:break-word;">
|
|
806
|
-
${
|
|
806
|
+
${q(r)}
|
|
807
807
|
</div>
|
|
808
808
|
`;
|
|
809
809
|
},
|
|
810
810
|
renderHtml(e) {
|
|
811
|
-
const t =
|
|
812
|
-
return
|
|
811
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor"), n = l(e, "color", "#000000"), i = l(e, "lineHeight", "140%"), r = l(e, "textAlign", "left"), s = l(e, "text"), a = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${r};word-wrap:break-word;">${s}</div>`;
|
|
812
|
+
return M(d, { padding: t, extraTdStyle: a });
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
},
|
|
815
|
+
}, xt = {
|
|
816
816
|
name: "heading",
|
|
817
817
|
label: "Heading",
|
|
818
818
|
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>',
|
|
@@ -914,19 +914,19 @@ const tt = {
|
|
|
914
914
|
},
|
|
915
915
|
renderer: {
|
|
916
916
|
renderEditor(e) {
|
|
917
|
-
const t =
|
|
918
|
-
return
|
|
919
|
-
<div style="padding:${t};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${
|
|
917
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), r = l(e, "fontWeight", "700"), s = l(e, "lineHeight", "140%"), a = l(e, "text", "Heading");
|
|
918
|
+
return c`
|
|
919
|
+
<div style="padding:${t};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};">
|
|
920
920
|
${a}
|
|
921
921
|
</div>
|
|
922
922
|
`;
|
|
923
923
|
},
|
|
924
924
|
renderHtml(e) {
|
|
925
|
-
const t =
|
|
926
|
-
return
|
|
925
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), r = l(e, "fontWeight", "700"), s = l(e, "lineHeight", "140%"), a = l(e, "letterSpacing", "normal"), d = l(e, "headingType", "h1"), p = l(e, "text", "Heading"), h = `<${d} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};letter-spacing:${a};">${p}</${d}>`;
|
|
926
|
+
return M(h, { padding: t });
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
},
|
|
929
|
+
}, yt = {
|
|
930
930
|
name: "paragraph",
|
|
931
931
|
label: "Paragraph",
|
|
932
932
|
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>',
|
|
@@ -969,15 +969,15 @@ const tt = {
|
|
|
969
969
|
},
|
|
970
970
|
renderer: {
|
|
971
971
|
renderEditor(e) {
|
|
972
|
-
const t =
|
|
973
|
-
return
|
|
972
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%");
|
|
973
|
+
return c`<div style="padding:${t};color:${o};line-height:${n};word-break:break-word;">${q(l(e, "text"))}</div>`;
|
|
974
974
|
},
|
|
975
975
|
renderHtml(e) {
|
|
976
|
-
const t =
|
|
977
|
-
return
|
|
976
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%"), i = l(e, "textAlign", "left"), r = l(e, "letterSpacing", "normal"), s = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${r};word-wrap:break-word;">${l(e, "text")}</div>`;
|
|
977
|
+
return M(s, { padding: t });
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
|
-
},
|
|
980
|
+
}, wt = {
|
|
981
981
|
name: "image",
|
|
982
982
|
label: "Image",
|
|
983
983
|
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>',
|
|
@@ -1038,15 +1038,15 @@ const tt = {
|
|
|
1038
1038
|
},
|
|
1039
1039
|
renderer: {
|
|
1040
1040
|
renderEditor(e) {
|
|
1041
|
-
const t =
|
|
1042
|
-
return o ?
|
|
1041
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "src"), n = l(e, "alt"), i = l(e, "width", "100%"), r = l(e, "borderRadius", "0px"), s = l(e, "align", "center");
|
|
1042
|
+
return o ? c`<div style="padding:${t};text-align:${s};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${i};border-radius:${r};border:0;" /></div>` : c`<div style="padding:${t};text-align:${s};"><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
1043
|
},
|
|
1044
1044
|
renderHtml(e, t) {
|
|
1045
|
-
const o =
|
|
1046
|
-
return
|
|
1045
|
+
const o = l(e, "containerPadding", "10px"), n = l(e, "src"), i = l(e, "alt"), r = l(e, "href"), s = l(e, "target", "_blank"), a = l(e, "width", "100%"), d = l(e, "borderRadius", "0px"), p = l(e, "align", "center"), h = a === "100%" ? t.columnWidth : parseInt(a), 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:${a};max-width:${h}px;${g}" width="${h}" />`, m = r ? `<a href="${r}" target="${s}" style="text-decoration:none;">${u}</a>` : u;
|
|
1046
|
+
return M(m, { padding: o, align: p });
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
|
-
},
|
|
1049
|
+
}, vt = {
|
|
1050
1050
|
name: "button",
|
|
1051
1051
|
label: "Button",
|
|
1052
1052
|
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>',
|
|
@@ -1133,24 +1133,24 @@ const tt = {
|
|
|
1133
1133
|
},
|
|
1134
1134
|
renderer: {
|
|
1135
1135
|
renderEditor(e) {
|
|
1136
|
-
const t =
|
|
1137
|
-
return
|
|
1138
|
-
<div style="padding:${t};text-align:${
|
|
1139
|
-
<a style="${
|
|
1136
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), r = l(e, "fontWeight", "700"), s = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), p = l(e, "textAlign", "center"), h = l(e, "buttonWidth", "auto"), g = l(e, "borderWidth", "0px"), u = l(e, "borderColor", o), m = g !== "0px" ? `border:${g} solid ${u};` : "border:none;", x = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
|
|
1137
|
+
return c`
|
|
1138
|
+
<div style="padding:${t};text-align:${p};">
|
|
1139
|
+
<a style="${x}background-color:${o};color:${n};font-size:${i};font-weight:${r};border-radius:${s};padding:${a};text-decoration:none;text-align:center;${m}cursor:pointer;font-family:arial,helvetica,sans-serif;box-sizing:border-box;">${d}</a>
|
|
1140
1140
|
</div>
|
|
1141
1141
|
`;
|
|
1142
1142
|
},
|
|
1143
1143
|
renderHtml(e) {
|
|
1144
|
-
const t =
|
|
1145
|
-
<!--[if !mso]><!-->` : "<!--[if !mso]><!-->",
|
|
1146
|
-
${
|
|
1147
|
-
<a href="${
|
|
1144
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), r = l(e, "fontWeight", "700"), s = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), p = l(e, "textAlign", "center"), h = l(e, "href", "#"), g = l(e, "target", "_blank"), u = l(e, "borderWidth", "0px"), m = l(e, "borderColor", o), x = u !== "0px" ? `border:${u} solid ${m};` : "border:none;", f = ft(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: r, borderRadius: s }), C = f ? `${f}
|
|
1145
|
+
<!--[if !mso]><!-->` : "<!--[if !mso]><!-->", V = `<div align="${p}">
|
|
1146
|
+
${C}
|
|
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:${a};font-family:arial,helvetica,sans-serif;${x}mso-border-alt:none;word-break:keep-all;"><span style="line-height:120%;">${d}</span></a>
|
|
1148
1148
|
<!--<![endif]-->
|
|
1149
1149
|
</div>`;
|
|
1150
|
-
return
|
|
1150
|
+
return M(V, { padding: t, align: p });
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
|
-
},
|
|
1153
|
+
}, $t = {
|
|
1154
1154
|
name: "divider",
|
|
1155
1155
|
label: "Divider",
|
|
1156
1156
|
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>',
|
|
@@ -1197,53 +1197,53 @@ const tt = {
|
|
|
1197
1197
|
},
|
|
1198
1198
|
renderer: {
|
|
1199
1199
|
renderEditor(e) {
|
|
1200
|
-
const t =
|
|
1201
|
-
return
|
|
1200
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "borderTopColor", "#cccccc")}`;
|
|
1201
|
+
return c`<div style="padding:${t};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
|
|
1202
1202
|
},
|
|
1203
1203
|
renderHtml(e) {
|
|
1204
|
-
const t =
|
|
1205
|
-
return
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
},
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
],
|
|
1204
|
+
const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "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>`;
|
|
1205
|
+
return M(i, { padding: t, align: "center" });
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}, kt = [
|
|
1209
|
+
mt,
|
|
1210
|
+
xt,
|
|
1211
|
+
yt,
|
|
1212
|
+
wt,
|
|
1213
|
+
vt,
|
|
1214
|
+
$t
|
|
1215
|
+
], Z = [
|
|
1216
1216
|
{
|
|
1217
1217
|
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-
|
|
1218
|
+
loader: () => import("./html-tool-Cqvglh05.js").then((e) => e.htmlTool)
|
|
1219
1219
|
},
|
|
1220
1220
|
{
|
|
1221
1221
|
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-
|
|
1222
|
+
loader: () => import("./social-tool-MqaqWdRm.js").then((e) => e.socialTool)
|
|
1223
1223
|
},
|
|
1224
1224
|
{
|
|
1225
1225
|
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-
|
|
1226
|
+
loader: () => import("./menu-tool-ACBHeTTN.js").then((e) => e.menuTool)
|
|
1227
1227
|
},
|
|
1228
1228
|
{
|
|
1229
1229
|
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-
|
|
1230
|
+
loader: () => import("./video-tool-8g1_UVbn.js").then((e) => e.videoTool)
|
|
1231
1231
|
},
|
|
1232
1232
|
{
|
|
1233
1233
|
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-
|
|
1234
|
+
loader: () => import("./timer-tool-BxrGmF-W.js").then((e) => e.timerTool)
|
|
1235
1235
|
},
|
|
1236
1236
|
{
|
|
1237
1237
|
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-
|
|
1238
|
+
loader: () => import("./table-tool-AnVvJ0rV.js").then((e) => e.tableTool)
|
|
1239
1239
|
},
|
|
1240
1240
|
{
|
|
1241
1241
|
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-
|
|
1242
|
+
loader: () => import("./form-tool-CxJstLJz.js").then((e) => e.formTool)
|
|
1243
1243
|
}
|
|
1244
1244
|
];
|
|
1245
|
-
function
|
|
1246
|
-
const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif",
|
|
1245
|
+
function Ct(e, t, o) {
|
|
1246
|
+
const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif", s = o.textColor || "#000000", a = o.preheaderText || "", d = a ? `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${a}${"‌ ".repeat(80)}</div>` : "";
|
|
1247
1247
|
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
1248
1248
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
1249
1249
|
<head>
|
|
@@ -1279,7 +1279,7 @@ function lt(e, t, o) {
|
|
|
1279
1279
|
a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; }
|
|
1280
1280
|
</style>
|
|
1281
1281
|
</head>
|
|
1282
|
-
<body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${n};color:${
|
|
1282
|
+
<body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${n};color:${s};">
|
|
1283
1283
|
${d}
|
|
1284
1284
|
<table id="u_body" style="border-collapse:collapse;table-layout:fixed;border-spacing:0;mso-table-lspace:0pt;mso-table-rspace:0pt;vertical-align:top;min-width:320px;margin:0 auto;background-color:${n};width:100%;" cellpadding="0" cellspacing="0" border="0">
|
|
1285
1285
|
<tbody>
|
|
@@ -1295,62 +1295,62 @@ function lt(e, t, o) {
|
|
|
1295
1295
|
</body>
|
|
1296
1296
|
</html>`;
|
|
1297
1297
|
}
|
|
1298
|
-
function
|
|
1299
|
-
const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "",
|
|
1300
|
-
const
|
|
1301
|
-
return
|
|
1298
|
+
function _t(e, t, o) {
|
|
1299
|
+
const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "", s = e.values.padding || "0px", a = e.cells.reduce((f, C) => f + C, 0), d = i ? `background-color:${i};` : "", p = e.values.backgroundImage?.url ? `background-image:url('${e.values.backgroundImage.url}');background-repeat:${e.values.backgroundImage.repeat ? "repeat" : "no-repeat"};background-position:center top;background-size:${e.values.backgroundImage.cover ? "cover" : "auto"};` : "", h = e.columns.map((f, C) => {
|
|
1300
|
+
const A = Math.round(e.cells[C] / a * n);
|
|
1301
|
+
return tt(f, A, r, t, o);
|
|
1302
1302
|
}), g = e.columns.length > 1;
|
|
1303
|
-
let
|
|
1303
|
+
let u;
|
|
1304
1304
|
if (g) {
|
|
1305
|
-
const
|
|
1306
|
-
const
|
|
1307
|
-
return `<!--[if (mso)|(IE)]><td align="center" width="${
|
|
1308
|
-
${
|
|
1305
|
+
const f = e.columns.map((C, A) => {
|
|
1306
|
+
const V = Math.round(e.cells[A] / a * n), it = tt(C, V, r, t, o);
|
|
1307
|
+
return `<!--[if (mso)|(IE)]><td align="center" width="${V}" style="width:${V}px;padding:0px;border:none;" valign="top"><![endif]-->
|
|
1308
|
+
${it}
|
|
1309
1309
|
<!--[if (mso)|(IE)]></td><![endif]-->`;
|
|
1310
1310
|
});
|
|
1311
|
-
|
|
1311
|
+
u = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${f.join(`
|
|
1312
1312
|
`)}</tr></table><![endif]-->
|
|
1313
1313
|
|
|
1314
1314
|
<!--[if !mso]><!-->
|
|
1315
1315
|
<div style="max-width:${n}px;margin:0 auto;">
|
|
1316
|
-
${
|
|
1316
|
+
${h.join(`
|
|
1317
1317
|
`)}
|
|
1318
1318
|
</div>
|
|
1319
1319
|
<!--<![endif]-->`;
|
|
1320
1320
|
} else
|
|
1321
|
-
|
|
1321
|
+
u = h.join(`
|
|
1322
1322
|
`);
|
|
1323
|
-
const
|
|
1324
|
-
return `<div class="u_row${
|
|
1323
|
+
const m = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
|
|
1324
|
+
return `<div class="u_row${m}${x}" style="padding:${s};${d}${p}">
|
|
1325
1325
|
<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
1326
|
<div style="border-collapse:collapse;display:table;width:100%;height:100%;background-color:transparent;">
|
|
1327
|
-
${
|
|
1327
|
+
${u}
|
|
1328
1328
|
</div>
|
|
1329
1329
|
</div>
|
|
1330
1330
|
</div>`;
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1333
|
-
const r = e.values.backgroundColor || o || "",
|
|
1334
|
-
const g = i.get(
|
|
1335
|
-
if (!g) return `<!-- unknown tool: ${
|
|
1336
|
-
const
|
|
1332
|
+
function tt(e, t, o, n, i) {
|
|
1333
|
+
const r = e.values.backgroundColor || o || "", s = e.values.padding || "0px", a = e.values.borderRadius || "0px", d = r ? `background-color:${r};` : "", p = e.contents.map((h) => {
|
|
1334
|
+
const g = i.get(h.type);
|
|
1335
|
+
if (!g) return `<!-- unknown tool: ${h.type} -->`;
|
|
1336
|
+
const u = {
|
|
1337
1337
|
columnWidth: t,
|
|
1338
1338
|
displayMode: "email",
|
|
1339
1339
|
contentWidth: parseInt(n.contentWidth || "600"),
|
|
1340
1340
|
bodyValues: n
|
|
1341
1341
|
};
|
|
1342
|
-
return g(
|
|
1342
|
+
return g(h.values, u);
|
|
1343
1343
|
}).join(`
|
|
1344
1344
|
`);
|
|
1345
1345
|
return `<div class="u_column" style="max-width:${t}px;min-width:${Math.min(t, 320)}px;display:table-cell;vertical-align:top;">
|
|
1346
1346
|
<div style="height:100%;width:100% !important;border-radius:${a};-webkit-border-radius:${a};${d}">
|
|
1347
|
-
<div style="box-sizing:border-box;height:100%;padding:${
|
|
1348
|
-
${
|
|
1347
|
+
<div style="box-sizing:border-box;height:100%;padding:${s};border:none;border-radius:${a};-webkit-border-radius:${a};">
|
|
1348
|
+
${p || '<!--[if (!mso)&(!IE)]><!--><div style="height:0;min-height:1px;font-size:0;"> </div><!--<![endif]-->'}
|
|
1349
1349
|
</div>
|
|
1350
1350
|
</div>
|
|
1351
1351
|
</div>`;
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function Dt(e) {
|
|
1354
1354
|
return `
|
|
1355
1355
|
@media only screen and (min-width: ${e + 20}px) {
|
|
1356
1356
|
.u_row .u_column { display: table-cell; }
|
|
@@ -1400,34 +1400,1081 @@ function dt(e) {
|
|
|
1400
1400
|
.u_hide_mobile { display: block !important; }
|
|
1401
1401
|
}`;
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1404
|
-
const n = e.body.values, i = parseInt(n.contentWidth || "600"), r = e.body.rows.map((g) =>
|
|
1405
|
-
`),
|
|
1406
|
-
let a =
|
|
1403
|
+
function Rt(e, t, o) {
|
|
1404
|
+
const n = e.body.values, i = parseInt(n.contentWidth || "600"), r = e.body.rows.map((g) => _t(g, n, t)).join(`
|
|
1405
|
+
`), s = Dt(i);
|
|
1406
|
+
let a = Ct(r, s, n);
|
|
1407
1407
|
if (o?.mergeTags)
|
|
1408
|
-
for (const [g,
|
|
1409
|
-
a = a.replaceAll(`{{${g}}}`,
|
|
1410
|
-
const d = a.match(/<body[^>]*>([\s\S]*)<\/body>/i),
|
|
1411
|
-
return n.fontFamily?.url &&
|
|
1408
|
+
for (const [g, u] of Object.entries(o.mergeTags))
|
|
1409
|
+
a = a.replaceAll(`{{${g}}}`, u);
|
|
1410
|
+
const d = a.match(/<body[^>]*>([\s\S]*)<\/body>/i), p = a.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), h = [];
|
|
1411
|
+
return n.fontFamily?.url && h.push(n.fontFamily.url), {
|
|
1412
1412
|
design: structuredClone(e),
|
|
1413
1413
|
html: a,
|
|
1414
1414
|
chunks: {
|
|
1415
1415
|
body: d?.[1] ?? r,
|
|
1416
|
-
css:
|
|
1417
|
-
`) ??
|
|
1418
|
-
fonts:
|
|
1416
|
+
css: p?.map((g) => g.replace(/<\/?style[^>]*>/gi, "")).join(`
|
|
1417
|
+
`) ?? s,
|
|
1418
|
+
fonts: h,
|
|
1419
1419
|
js: ""
|
|
1420
1420
|
}
|
|
1421
1421
|
};
|
|
1422
1422
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1423
|
+
class R {
|
|
1424
|
+
/**
|
|
1425
|
+
* @param host - The Lit component that owns this controller
|
|
1426
|
+
* @param channels - Which store channels to subscribe to
|
|
1427
|
+
*/
|
|
1428
|
+
constructor(t, o) {
|
|
1429
|
+
this.store = null, this.host = t, this.channels = o, t.addController(this);
|
|
1430
|
+
}
|
|
1431
|
+
/** Set or change the store reference. Re-subscribes automatically. */
|
|
1432
|
+
setStore(t) {
|
|
1433
|
+
this.store !== t && (this.unsub?.(), this.store = t, this.subscribe());
|
|
1434
|
+
}
|
|
1435
|
+
hostConnected() {
|
|
1436
|
+
this.subscribe();
|
|
1437
|
+
}
|
|
1438
|
+
hostDisconnected() {
|
|
1439
|
+
this.unsub?.(), this.unsub = void 0;
|
|
1440
|
+
}
|
|
1441
|
+
subscribe() {
|
|
1442
|
+
this.store && (this.unsub = this.store.subscribeChannels(this.channels, () => {
|
|
1443
|
+
this.host.requestUpdate();
|
|
1444
|
+
}));
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
var St = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, j = (e, t, o, n) => {
|
|
1448
|
+
for (var i = n > 1 ? void 0 : n ? Tt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
1449
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
1450
|
+
return n && i && St(t, o, i), i;
|
|
1451
|
+
};
|
|
1452
|
+
let _ = class extends w {
|
|
1453
|
+
constructor() {
|
|
1454
|
+
super(...arguments), this.storeCtrl = new R(this, ["design", "selection", "hover"]), this._onDragStart = (e) => {
|
|
1455
|
+
e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", z.startContentDrag(this.content.id);
|
|
1456
|
+
}, this._onDragEnd = () => {
|
|
1457
|
+
this.style.opacity = "1", z.reset();
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
set store(e) {
|
|
1461
|
+
this.storeCtrl.setStore(e);
|
|
1462
|
+
}
|
|
1463
|
+
get store() {
|
|
1464
|
+
return this.storeCtrl.store;
|
|
1465
|
+
}
|
|
1466
|
+
handleClick(e) {
|
|
1467
|
+
e.stopPropagation(), this.store.select(this.content.id);
|
|
1468
|
+
}
|
|
1469
|
+
handleMouseEnter() {
|
|
1470
|
+
this.store.hover(this.content.id);
|
|
1471
|
+
}
|
|
1472
|
+
handleMouseLeave() {
|
|
1473
|
+
this.store.hover(null);
|
|
1474
|
+
}
|
|
1475
|
+
handleDelete(e) {
|
|
1476
|
+
e.stopPropagation(), this.store.removeContent(this.content.id);
|
|
1477
|
+
}
|
|
1478
|
+
handleDuplicate(e) {
|
|
1479
|
+
e.stopPropagation(), this.store.duplicateContent(this.content.id);
|
|
1480
|
+
}
|
|
1481
|
+
connectedCallback() {
|
|
1482
|
+
super.connectedCallback(), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragend", this._onDragEnd);
|
|
1483
|
+
}
|
|
1484
|
+
disconnectedCallback() {
|
|
1485
|
+
super.disconnectedCallback(), this.removeEventListener("dragstart", this._onDragStart), this.removeEventListener("dragend", this._onDragEnd);
|
|
1486
|
+
}
|
|
1487
|
+
render() {
|
|
1488
|
+
if (!this.store) return c``;
|
|
1489
|
+
const e = this.store.selectedId === this.content.id, t = this.store.hoveredId === this.content.id;
|
|
1490
|
+
this.classList.toggle("selected", e), this.classList.toggle("hovered", t), this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id;
|
|
1491
|
+
const o = this.toolRegistry.get(this.content.type);
|
|
1492
|
+
if (!o && this.toolRegistry.has(this.content.type))
|
|
1493
|
+
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 n = o?.renderer.renderEditor(this.content.values, {
|
|
1495
|
+
isSelected: e,
|
|
1496
|
+
isHovered: t,
|
|
1497
|
+
columnWidth: 600,
|
|
1498
|
+
displayMode: "email"
|
|
1499
|
+
});
|
|
1500
|
+
return c`
|
|
1501
|
+
<div class="action-bar">
|
|
1502
|
+
<button class="action-btn" @click=${this.handleDuplicate} title="Duplicate">♻</button>
|
|
1503
|
+
<button class="action-btn" @click=${this.handleDelete} title="Delete">✕</button>
|
|
1504
|
+
</div>
|
|
1505
|
+
<div class="content-wrapper" @click=${this.handleClick}
|
|
1506
|
+
@mouseenter=${this.handleMouseEnter} @mouseleave=${this.handleMouseLeave}>
|
|
1507
|
+
${n ?? c`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
|
|
1508
|
+
</div>
|
|
1509
|
+
`;
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
_.styles = v`
|
|
1513
|
+
:host {
|
|
1514
|
+
display: block; position: relative; cursor: pointer;
|
|
1515
|
+
transition: outline 0.15s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
|
|
1516
|
+
}
|
|
1517
|
+
:host(.selected) { outline: 2px solid #3b82f6; outline-offset: -1px; }
|
|
1518
|
+
:host(.hovered:not(.selected)) { outline: 2px dashed #93c5fd; outline-offset: -1px; }
|
|
1519
|
+
:host(.just-dropped) {
|
|
1520
|
+
animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
1521
|
+
}
|
|
1522
|
+
@keyframes dropIn {
|
|
1523
|
+
0% { opacity: 0; transform: scale(0.92) translateY(-8px); }
|
|
1524
|
+
100% { opacity: 1; transform: scale(1) translateY(0); }
|
|
1525
|
+
}
|
|
1526
|
+
.action-bar {
|
|
1527
|
+
display: none; position: absolute; top: -28px; right: 4px;
|
|
1528
|
+
background: #3b82f6; border-radius: 4px; padding: 2px; gap: 2px; z-index: 10;
|
|
1529
|
+
}
|
|
1530
|
+
:host(.selected) .action-bar { display: flex; }
|
|
1531
|
+
.action-btn {
|
|
1532
|
+
background: none; border: none; color: white; cursor: pointer;
|
|
1533
|
+
padding: 2px 6px; font-size: 12px; line-height: 1; border-radius: 2px;
|
|
1534
|
+
}
|
|
1535
|
+
.action-btn:hover { background: rgba(255,255,255,0.2); }
|
|
1536
|
+
.content-wrapper { position: relative; }
|
|
1537
|
+
`;
|
|
1538
|
+
j([
|
|
1539
|
+
b({ attribute: !1 })
|
|
1540
|
+
], _.prototype, "content", 2);
|
|
1541
|
+
j([
|
|
1542
|
+
b({ attribute: !1 })
|
|
1543
|
+
], _.prototype, "store", 1);
|
|
1544
|
+
j([
|
|
1545
|
+
b({ attribute: !1 })
|
|
1546
|
+
], _.prototype, "toolRegistry", 2);
|
|
1547
|
+
_ = j([
|
|
1548
|
+
$("me-content-renderer")
|
|
1549
|
+
], _);
|
|
1550
|
+
var It = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, B = (e, t, o, n) => {
|
|
1551
|
+
for (var i = n > 1 ? void 0 : n ? Pt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
1552
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
1553
|
+
return n && i && It(t, o, i), i;
|
|
1554
|
+
};
|
|
1555
|
+
let y = class extends w {
|
|
1556
|
+
constructor() {
|
|
1557
|
+
super(...arguments), this.storeCtrl = new R(this, ["design"]), this.widthPercent = 100;
|
|
1558
|
+
}
|
|
1559
|
+
set store(e) {
|
|
1560
|
+
this.storeCtrl.setStore(e);
|
|
1561
|
+
}
|
|
1562
|
+
get store() {
|
|
1563
|
+
return this.storeCtrl.store;
|
|
1564
|
+
}
|
|
1565
|
+
render() {
|
|
1566
|
+
const e = this.column.values.padding || "0px", t = this.column.values.backgroundColor || "transparent", o = this.column.contents;
|
|
1567
|
+
return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding = e, this.style.backgroundColor = t, this.style.verticalAlign = "top", this.style.boxSizing = "border-box", o.length === 0 ? c`
|
|
1568
|
+
<div class="empty-column" data-column-id=${this.column.id}>
|
|
1569
|
+
Drag content here
|
|
1570
|
+
</div>
|
|
1571
|
+
` : c`
|
|
1572
|
+
${o.map(
|
|
1573
|
+
(n) => c`
|
|
1574
|
+
<me-content-renderer
|
|
1575
|
+
.content=${n}
|
|
1576
|
+
.store=${this.store}
|
|
1577
|
+
.toolRegistry=${this.toolRegistry}
|
|
1578
|
+
></me-content-renderer>
|
|
1579
|
+
`
|
|
1580
|
+
)}
|
|
1581
|
+
`;
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
y.styles = v`
|
|
1585
|
+
:host {
|
|
1586
|
+
display: block;
|
|
1587
|
+
min-height: 40px;
|
|
1588
|
+
position: relative;
|
|
1589
|
+
}
|
|
1590
|
+
.empty-column {
|
|
1591
|
+
display: flex;
|
|
1592
|
+
align-items: center;
|
|
1593
|
+
justify-content: center;
|
|
1594
|
+
min-height: 60px;
|
|
1595
|
+
border: 2px dashed #d1d5db;
|
|
1596
|
+
border-radius: 4px;
|
|
1597
|
+
color: #9ca3af;
|
|
1598
|
+
font-size: 13px;
|
|
1599
|
+
font-family: sans-serif;
|
|
1600
|
+
margin: 4px;
|
|
1601
|
+
}
|
|
1602
|
+
.drop-indicator {
|
|
1603
|
+
height: 3px;
|
|
1604
|
+
background: #3b82f6;
|
|
1605
|
+
border-radius: 2px;
|
|
1606
|
+
margin: 0 4px;
|
|
1607
|
+
opacity: 0;
|
|
1608
|
+
transition: opacity 0.15s ease;
|
|
1609
|
+
}
|
|
1610
|
+
.drop-indicator.active {
|
|
1611
|
+
opacity: 1;
|
|
1612
|
+
}
|
|
1613
|
+
`;
|
|
1614
|
+
B([
|
|
1615
|
+
b({ attribute: !1 })
|
|
1616
|
+
], y.prototype, "column", 2);
|
|
1617
|
+
B([
|
|
1618
|
+
b({ attribute: !1 })
|
|
1619
|
+
], y.prototype, "store", 1);
|
|
1620
|
+
B([
|
|
1621
|
+
b({ attribute: !1 })
|
|
1622
|
+
], y.prototype, "toolRegistry", 2);
|
|
1623
|
+
B([
|
|
1624
|
+
b({ type: Number })
|
|
1625
|
+
], y.prototype, "widthPercent", 2);
|
|
1626
|
+
y = B([
|
|
1627
|
+
$("me-column-renderer")
|
|
1628
|
+
], y);
|
|
1629
|
+
var Mt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, W = (e, t, o, n) => {
|
|
1630
|
+
for (var i = n > 1 ? void 0 : n ? Vt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
1631
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
1632
|
+
return n && i && Mt(t, o, i), i;
|
|
1633
|
+
};
|
|
1634
|
+
let D = class extends w {
|
|
1635
|
+
constructor() {
|
|
1636
|
+
super(...arguments), this.storeCtrl = new R(this, ["design"]);
|
|
1637
|
+
}
|
|
1638
|
+
set store(e) {
|
|
1639
|
+
this.storeCtrl.setStore(e);
|
|
1640
|
+
}
|
|
1641
|
+
get store() {
|
|
1642
|
+
return this.storeCtrl.store;
|
|
1643
|
+
}
|
|
1644
|
+
handleMoveUp(e) {
|
|
1645
|
+
e.stopPropagation();
|
|
1646
|
+
const t = this.store.getRowIndex(this.row.id);
|
|
1647
|
+
t > 0 && this.store.moveRow(t, t - 1);
|
|
1648
|
+
}
|
|
1649
|
+
handleMoveDown(e) {
|
|
1650
|
+
e.stopPropagation();
|
|
1651
|
+
const t = this.store.getRowIndex(this.row.id), o = this.store.getRows().length;
|
|
1652
|
+
t < o - 1 && this.store.moveRow(t, t + 1);
|
|
1653
|
+
}
|
|
1654
|
+
handleDuplicate(e) {
|
|
1655
|
+
e.stopPropagation(), this.store.duplicateRow(this.row.id);
|
|
1656
|
+
}
|
|
1657
|
+
handleDelete(e) {
|
|
1658
|
+
e.stopPropagation(), this.store.removeRow(this.row.id);
|
|
1659
|
+
}
|
|
1660
|
+
render() {
|
|
1661
|
+
const { row: e, store: t, toolRegistry: o } = this, n = e.values.backgroundColor || "transparent", i = e.values.columnsBackgroundColor || "transparent", r = e.values.padding || "0px", s = e.cells.reduce((a, d) => a + d, 0);
|
|
1662
|
+
return this.setAttribute("draggable", "true"), this.dataset.rowId = e.id, c`
|
|
1663
|
+
<div class="row-actions">
|
|
1664
|
+
<button class="row-action-btn" @click=${this.handleMoveUp} title="Move Up">
|
|
1665
|
+
<svg viewBox="0 0 24 24"><path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>
|
|
1666
|
+
</button>
|
|
1667
|
+
<button class="row-action-btn" @click=${this.handleMoveDown} title="Move Down">
|
|
1668
|
+
<svg viewBox="0 0 24 24"><path d="M12 5v14"/><path d="m19 12-7 7-7-7"/></svg>
|
|
1669
|
+
</button>
|
|
1670
|
+
<button class="row-action-btn" @click=${this.handleDuplicate} title="Duplicate Row">
|
|
1671
|
+
<svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
|
|
1672
|
+
</button>
|
|
1673
|
+
<button class="row-action-btn danger" @click=${this.handleDelete} title="Delete Row">
|
|
1674
|
+
<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
|
|
1675
|
+
</button>
|
|
1676
|
+
</div>
|
|
1677
|
+
<div
|
|
1678
|
+
class="row-wrapper"
|
|
1679
|
+
style="background-color:${n};padding:${r};"
|
|
1680
|
+
>
|
|
1681
|
+
${e.columns.map((a, d) => {
|
|
1682
|
+
const p = e.cells[d] / s * 100;
|
|
1683
|
+
return c`
|
|
1684
|
+
<me-column-renderer
|
|
1685
|
+
.column=${a}
|
|
1686
|
+
.store=${t}
|
|
1687
|
+
.toolRegistry=${o}
|
|
1688
|
+
.widthPercent=${p}
|
|
1689
|
+
style="background-color:${i};"
|
|
1690
|
+
></me-column-renderer>
|
|
1691
|
+
`;
|
|
1692
|
+
})}
|
|
1693
|
+
</div>
|
|
1694
|
+
`;
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
D.styles = v`
|
|
1698
|
+
:host {
|
|
1699
|
+
display: block;
|
|
1700
|
+
position: relative;
|
|
1701
|
+
}
|
|
1702
|
+
.row-wrapper {
|
|
1703
|
+
display: flex;
|
|
1704
|
+
flex-wrap: nowrap;
|
|
1705
|
+
position: relative;
|
|
1706
|
+
min-height: 30px;
|
|
1707
|
+
transition: box-shadow 0.15s ease;
|
|
1708
|
+
}
|
|
1709
|
+
:host(:hover) .row-wrapper {
|
|
1710
|
+
box-shadow: inset 0 0 0 1px #93c5fd;
|
|
1711
|
+
}
|
|
1712
|
+
.row-actions {
|
|
1713
|
+
display: none;
|
|
1714
|
+
position: absolute;
|
|
1715
|
+
right: -36px;
|
|
1716
|
+
top: 50%;
|
|
1717
|
+
transform: translateY(-50%);
|
|
1718
|
+
flex-direction: column;
|
|
1719
|
+
gap: 2px;
|
|
1720
|
+
z-index: 10;
|
|
1721
|
+
}
|
|
1722
|
+
:host(:hover) .row-actions {
|
|
1723
|
+
display: flex;
|
|
1724
|
+
}
|
|
1725
|
+
.row-action-btn {
|
|
1726
|
+
width: 28px;
|
|
1727
|
+
height: 28px;
|
|
1728
|
+
display: flex;
|
|
1729
|
+
align-items: center;
|
|
1730
|
+
justify-content: center;
|
|
1731
|
+
background: #6b7280;
|
|
1732
|
+
color: white;
|
|
1733
|
+
border: none;
|
|
1734
|
+
border-radius: 4px;
|
|
1735
|
+
cursor: pointer;
|
|
1736
|
+
font-size: 12px;
|
|
1737
|
+
line-height: 1;
|
|
1738
|
+
transition: background 0.15s ease;
|
|
1739
|
+
padding: 0;
|
|
1740
|
+
}
|
|
1741
|
+
.row-action-btn:hover { background: #3b82f6; }
|
|
1742
|
+
.row-action-btn.danger:hover { background: #ef4444; }
|
|
1743
|
+
.row-action-btn svg {
|
|
1744
|
+
width: 14px;
|
|
1745
|
+
height: 14px;
|
|
1746
|
+
stroke: currentColor;
|
|
1747
|
+
fill: none;
|
|
1748
|
+
stroke-width: 2;
|
|
1749
|
+
stroke-linecap: round;
|
|
1750
|
+
stroke-linejoin: round;
|
|
1751
|
+
}
|
|
1752
|
+
`;
|
|
1753
|
+
W([
|
|
1754
|
+
b({ attribute: !1 })
|
|
1755
|
+
], D.prototype, "row", 2);
|
|
1756
|
+
W([
|
|
1757
|
+
b({ attribute: !1 })
|
|
1758
|
+
], D.prototype, "store", 1);
|
|
1759
|
+
W([
|
|
1760
|
+
b({ attribute: !1 })
|
|
1761
|
+
], D.prototype, "toolRegistry", 2);
|
|
1762
|
+
D = W([
|
|
1763
|
+
$("me-row-renderer")
|
|
1764
|
+
], D);
|
|
1765
|
+
var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, G = (e, t, o, n) => {
|
|
1766
|
+
for (var i = n > 1 ? void 0 : n ? Et(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
1767
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
1768
|
+
return n && i && zt(t, o, i), i;
|
|
1769
|
+
};
|
|
1770
|
+
let T = class extends w {
|
|
1771
|
+
constructor() {
|
|
1772
|
+
super(...arguments), this.storeCtrl = new R(this, ["design", "viewMode"]);
|
|
1773
|
+
}
|
|
1774
|
+
set store(e) {
|
|
1775
|
+
this.storeCtrl.setStore(e);
|
|
1776
|
+
}
|
|
1777
|
+
get store() {
|
|
1778
|
+
return this.storeCtrl.store;
|
|
1779
|
+
}
|
|
1780
|
+
handleCanvasClick() {
|
|
1781
|
+
this.store.select(null);
|
|
1782
|
+
}
|
|
1783
|
+
setViewMode(e) {
|
|
1784
|
+
this.store.setViewMode(e);
|
|
1785
|
+
}
|
|
1786
|
+
render() {
|
|
1787
|
+
const e = this.store.getRows(), t = this.store.getBodyValues(), o = t.contentWidth || "600px", n = t.backgroundColor || "#e7e7e7", i = this.store.viewMode;
|
|
1788
|
+
return c`
|
|
1789
|
+
<div class="view-toggle">
|
|
1790
|
+
<button
|
|
1791
|
+
class="view-btn ${i === "desktop" ? "active" : ""}"
|
|
1792
|
+
@click=${() => this.setViewMode("desktop")}
|
|
1793
|
+
>Desktop</button>
|
|
1794
|
+
<button
|
|
1795
|
+
class="view-btn ${i === "mobile" ? "active" : ""}"
|
|
1796
|
+
@click=${() => this.setViewMode("mobile")}
|
|
1797
|
+
>Mobile</button>
|
|
1798
|
+
</div>
|
|
1799
|
+
|
|
1800
|
+
<div
|
|
1801
|
+
class="canvas-body"
|
|
1802
|
+
style="max-width:${i === "mobile" ? "375px" : o};background-color:${n};"
|
|
1803
|
+
@click=${this.handleCanvasClick}
|
|
1804
|
+
>
|
|
1805
|
+
${e.length === 0 ? c`
|
|
1806
|
+
<div class="empty-canvas">
|
|
1807
|
+
<div class="empty-icon">☰</div>
|
|
1808
|
+
<div>Drag a content block here</div>
|
|
1809
|
+
</div>
|
|
1810
|
+
` : e.map(
|
|
1811
|
+
(s) => c`
|
|
1812
|
+
<me-row-renderer
|
|
1813
|
+
.row=${s}
|
|
1814
|
+
.store=${this.store}
|
|
1815
|
+
.toolRegistry=${this.toolRegistry}
|
|
1816
|
+
></me-row-renderer>
|
|
1817
|
+
`
|
|
1818
|
+
)}
|
|
1819
|
+
</div>
|
|
1820
|
+
`;
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
T.styles = v`
|
|
1824
|
+
:host {
|
|
1825
|
+
display: block;
|
|
1826
|
+
flex: 1;
|
|
1827
|
+
overflow-y: auto;
|
|
1828
|
+
background: #f3f4f6;
|
|
1829
|
+
padding: 20px;
|
|
1830
|
+
}
|
|
1831
|
+
.canvas-body {
|
|
1832
|
+
margin: 0 auto;
|
|
1833
|
+
background: #ffffff;
|
|
1834
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
|
|
1835
|
+
min-height: 200px;
|
|
1836
|
+
position: relative;
|
|
1837
|
+
}
|
|
1838
|
+
.empty-canvas {
|
|
1839
|
+
display: flex;
|
|
1840
|
+
flex-direction: column;
|
|
1841
|
+
align-items: center;
|
|
1842
|
+
justify-content: center;
|
|
1843
|
+
min-height: 300px;
|
|
1844
|
+
color: #9ca3af;
|
|
1845
|
+
font-family: sans-serif;
|
|
1846
|
+
font-size: 14px;
|
|
1847
|
+
gap: 8px;
|
|
1848
|
+
}
|
|
1849
|
+
.empty-icon {
|
|
1850
|
+
font-size: 40px;
|
|
1851
|
+
opacity: 0.4;
|
|
1852
|
+
}
|
|
1853
|
+
.view-toggle {
|
|
1854
|
+
display: flex;
|
|
1855
|
+
justify-content: center;
|
|
1856
|
+
margin-bottom: 12px;
|
|
1857
|
+
gap: 4px;
|
|
1858
|
+
}
|
|
1859
|
+
.view-btn {
|
|
1860
|
+
padding: 6px 16px;
|
|
1861
|
+
border: 1px solid #d1d5db;
|
|
1862
|
+
background: white;
|
|
1863
|
+
cursor: pointer;
|
|
1864
|
+
font-size: 13px;
|
|
1865
|
+
font-family: sans-serif;
|
|
1866
|
+
color: #374151;
|
|
1867
|
+
transition: all 0.15s ease;
|
|
1868
|
+
}
|
|
1869
|
+
.view-btn:first-child { border-radius: 6px 0 0 6px; }
|
|
1870
|
+
.view-btn:last-child { border-radius: 0 6px 6px 0; }
|
|
1871
|
+
.view-btn.active {
|
|
1872
|
+
background: #3b82f6;
|
|
1873
|
+
border-color: #3b82f6;
|
|
1874
|
+
color: white;
|
|
1875
|
+
}
|
|
1876
|
+
`;
|
|
1877
|
+
G([
|
|
1878
|
+
b({ attribute: !1 })
|
|
1879
|
+
], T.prototype, "store", 1);
|
|
1880
|
+
G([
|
|
1881
|
+
b({ attribute: !1 })
|
|
1882
|
+
], T.prototype, "toolRegistry", 2);
|
|
1883
|
+
T = G([
|
|
1884
|
+
$("me-editor-canvas")
|
|
1885
|
+
], T);
|
|
1886
|
+
var Lt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, ot = (e, t, o, n) => {
|
|
1887
|
+
for (var i = n > 1 ? void 0 : n ? Bt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
1888
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
1889
|
+
return n && i && Lt(t, o, i), i;
|
|
1890
|
+
};
|
|
1891
|
+
const et = [
|
|
1892
|
+
{ label: "Arial", value: "arial,helvetica,sans-serif" },
|
|
1893
|
+
{ label: "Helvetica", value: "helvetica,sans-serif" },
|
|
1894
|
+
{ label: "Georgia", value: "georgia,serif" },
|
|
1895
|
+
{ label: "Times New Roman", value: "'times new roman',times,serif" },
|
|
1896
|
+
{ label: "Trebuchet MS", value: "trebuchet ms,helvetica,sans-serif" },
|
|
1897
|
+
{ label: "Verdana", value: "verdana,geneva,sans-serif" },
|
|
1898
|
+
{ label: "Courier New", value: "'courier new',courier,monospace" }
|
|
1899
|
+
];
|
|
1900
|
+
let E = class extends w {
|
|
1901
|
+
constructor() {
|
|
1902
|
+
super(...arguments), this.storeCtrl = new R(this, ["design"]);
|
|
1903
|
+
}
|
|
1904
|
+
set store(e) {
|
|
1905
|
+
this.storeCtrl.setStore(e);
|
|
1906
|
+
}
|
|
1907
|
+
get store() {
|
|
1908
|
+
return this.storeCtrl.store;
|
|
1909
|
+
}
|
|
1910
|
+
update_(e, t) {
|
|
1911
|
+
this.store.updateBodyValues({ [e]: t });
|
|
1912
|
+
}
|
|
1913
|
+
updateLinkStyle(e, t) {
|
|
1914
|
+
const o = this.store.getBodyValues().linkStyle;
|
|
1915
|
+
this.store.updateBodyValues({ linkStyle: { ...o, [e]: t } });
|
|
1916
|
+
}
|
|
1917
|
+
updateFontFamily(e) {
|
|
1918
|
+
const t = et.find((o) => o.value === e);
|
|
1919
|
+
this.store.updateBodyValues({ fontFamily: { label: t?.label || e, value: e } });
|
|
1920
|
+
}
|
|
1921
|
+
render() {
|
|
1922
|
+
const e = this.store.getBodyValues();
|
|
1923
|
+
return c`
|
|
1924
|
+
${this.renderColorField("Background Color", e.backgroundColor || "#e7e7e7", (t) => this.update_("backgroundColor", t))}
|
|
1925
|
+
|
|
1926
|
+
<p class="section-title" style="margin-top:16px;">Content</p>
|
|
1927
|
+
<div class="field">
|
|
1928
|
+
<label class="field-label">Content Width (px)</label>
|
|
1929
|
+
<input class="input" type="number" .value=${parseInt(e.contentWidth || "600")} min="320" max="960" step="10"
|
|
1930
|
+
@change=${(t) => this.update_("contentWidth", t.target.value + "px")} />
|
|
1931
|
+
</div>
|
|
1932
|
+
<div class="field">
|
|
1933
|
+
<label class="field-label">Content Align</label>
|
|
1934
|
+
<div class="align-group">
|
|
1935
|
+
${["left", "center", "right"].map((t) => c`
|
|
1936
|
+
<button class="align-btn ${e.contentAlign === t ? "active" : ""}"
|
|
1937
|
+
@click=${() => this.update_("contentAlign", t)}>${t}</button>
|
|
1938
|
+
`)}
|
|
1939
|
+
</div>
|
|
1940
|
+
</div>
|
|
1941
|
+
|
|
1942
|
+
<p class="section-title" style="margin-top:16px;">Typography</p>
|
|
1943
|
+
<div class="field">
|
|
1944
|
+
<label class="field-label">Font Family</label>
|
|
1945
|
+
<select class="input" @change=${(t) => this.updateFontFamily(t.target.value)}>
|
|
1946
|
+
${et.map((t) => c`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
|
|
1947
|
+
</select>
|
|
1948
|
+
</div>
|
|
1949
|
+
${this.renderColorField("Text Color", e.textColor || "#000000", (t) => this.update_("textColor", t))}
|
|
1950
|
+
|
|
1951
|
+
<p class="section-title" style="margin-top:16px;">Links</p>
|
|
1952
|
+
${this.renderColorField("Link Color", e.linkStyle?.linkColor || "#0000ee", (t) => this.updateLinkStyle("linkColor", t))}
|
|
1953
|
+
<div class="field">
|
|
1954
|
+
<label style="display:flex;align-items:center;gap:8px;font-size:12px;color:#6b7280;cursor:pointer;">
|
|
1955
|
+
<input type="checkbox" .checked=${e.linkStyle?.linkUnderline ?? !0}
|
|
1956
|
+
@change=${(t) => this.updateLinkStyle("linkUnderline", t.target.checked)} />
|
|
1957
|
+
Underline Links
|
|
1958
|
+
</label>
|
|
1959
|
+
</div>
|
|
1960
|
+
|
|
1961
|
+
<p class="section-title" style="margin-top:16px;">Email</p>
|
|
1962
|
+
<div class="field">
|
|
1963
|
+
<label class="field-label">Preheader Text</label>
|
|
1964
|
+
<textarea class="input" .value=${e.preheaderText || ""} placeholder="Preview text shown in inbox..."
|
|
1965
|
+
style="min-height:60px;resize:vertical;font-family:inherit;"
|
|
1966
|
+
@change=${(t) => this.update_("preheaderText", t.target.value)}></textarea>
|
|
1967
|
+
</div>
|
|
1968
|
+
`;
|
|
1969
|
+
}
|
|
1970
|
+
/** Reusable color field (swatch + hex input) */
|
|
1971
|
+
renderColorField(e, t, o) {
|
|
1972
|
+
return c`
|
|
1973
|
+
<div class="field">
|
|
1974
|
+
<label class="field-label">${e}</label>
|
|
1975
|
+
<div class="color-row">
|
|
1976
|
+
<input class="color-swatch" type="color" .value=${t} @input=${(n) => o(n.target.value)} />
|
|
1977
|
+
<input class="input" type="text" .value=${t} style="flex:1;" @change=${(n) => o(n.target.value)} />
|
|
1978
|
+
</div>
|
|
1979
|
+
</div>
|
|
1980
|
+
`;
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
E.styles = v`
|
|
1984
|
+
:host { display: block; }
|
|
1985
|
+
.section-title {
|
|
1986
|
+
font-size: 11px; font-weight: 600; text-transform: uppercase;
|
|
1987
|
+
color: #9ca3af; letter-spacing: 0.05em; margin: 0 0 8px 0;
|
|
1988
|
+
}
|
|
1989
|
+
.field { margin-bottom: 12px; }
|
|
1990
|
+
.field-label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
|
|
1991
|
+
.input {
|
|
1992
|
+
width: 100%; padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 4px;
|
|
1993
|
+
font-size: 12px; box-sizing: border-box;
|
|
1994
|
+
}
|
|
1995
|
+
.input:focus { outline: none; border-color: #3b82f6; }
|
|
1996
|
+
.color-row { display: flex; gap: 6px; align-items: center; }
|
|
1997
|
+
.color-swatch {
|
|
1998
|
+
width: 32px; height: 32px; border: 1px solid #d1d5db; border-radius: 4px;
|
|
1999
|
+
padding: 0; cursor: pointer;
|
|
2000
|
+
}
|
|
2001
|
+
.align-group { display: flex; gap: 2px; }
|
|
2002
|
+
.align-btn {
|
|
2003
|
+
flex: 1; padding: 5px; border: 1px solid #d1d5db; background: white;
|
|
2004
|
+
border-radius: 4px; cursor: pointer; font-size: 11px; color: #6b7280;
|
|
2005
|
+
}
|
|
2006
|
+
.align-btn.active { border-color: #3b82f6; background: #eff6ff; color: #3b82f6; }
|
|
2007
|
+
`;
|
|
2008
|
+
ot([
|
|
2009
|
+
b({ attribute: !1 })
|
|
2010
|
+
], E.prototype, "store", 1);
|
|
2011
|
+
E = ot([
|
|
2012
|
+
$("me-body-settings")
|
|
2013
|
+
], E);
|
|
2014
|
+
var At = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Y = (e, t, o, n) => {
|
|
2015
|
+
for (var i = n > 1 ? void 0 : n ? Ot(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
2016
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
2017
|
+
return n && i && At(t, o, i), i;
|
|
2018
|
+
};
|
|
2019
|
+
let I = class extends w {
|
|
2020
|
+
constructor() {
|
|
2021
|
+
super(...arguments), this.storeCtrl = new R(this, ["activeTab"]);
|
|
2022
|
+
}
|
|
2023
|
+
set store(e) {
|
|
2024
|
+
this.storeCtrl.setStore(e);
|
|
2025
|
+
}
|
|
2026
|
+
get store() {
|
|
2027
|
+
return this.storeCtrl.store;
|
|
2028
|
+
}
|
|
2029
|
+
handleDragStart(e, t) {
|
|
2030
|
+
e.dataTransfer.setData("application/maileditor-tool", t), e.dataTransfer.effectAllowed = "copy";
|
|
2031
|
+
}
|
|
2032
|
+
handleLayoutDragStart(e, t) {
|
|
2033
|
+
e.dataTransfer.setData("application/maileditor-layout", JSON.stringify(t)), e.dataTransfer.effectAllowed = "copy";
|
|
2034
|
+
}
|
|
2035
|
+
addRowWithLayout(e) {
|
|
2036
|
+
const t = this.store.createRow(e);
|
|
2037
|
+
this.store.addRow(t);
|
|
2038
|
+
}
|
|
2039
|
+
render() {
|
|
2040
|
+
const e = this.store.activeTab, t = this.toolRegistry.getAllMeta();
|
|
2041
|
+
return c`
|
|
2042
|
+
<div class="tabs">
|
|
2043
|
+
<button class="tab ${e === "content" ? "active" : ""}" @click=${() => this.store.setActiveTab("content")}>Content</button>
|
|
2044
|
+
<button class="tab ${e === "blocks" ? "active" : ""}" @click=${() => this.store.setActiveTab("blocks")}>Blocks</button>
|
|
2045
|
+
<button class="tab ${e === "body" ? "active" : ""}" @click=${() => this.store.setActiveTab("body")}>Body</button>
|
|
2046
|
+
</div>
|
|
2047
|
+
|
|
2048
|
+
<div class="tab-content">
|
|
2049
|
+
${e === "content" ? this.renderContentTab(t) : ""}
|
|
2050
|
+
${e === "blocks" ? this.renderBlocksTab() : ""}
|
|
2051
|
+
${e === "body" ? this.renderBodyTab() : ""}
|
|
2052
|
+
</div>
|
|
2053
|
+
`;
|
|
2054
|
+
}
|
|
2055
|
+
renderContentTab(e) {
|
|
2056
|
+
return c`
|
|
2057
|
+
<p class="section-title">Content</p>
|
|
2058
|
+
<div class="tool-grid">
|
|
2059
|
+
${e.map(
|
|
2060
|
+
(t) => c`
|
|
2061
|
+
<div
|
|
2062
|
+
class="tool-item"
|
|
2063
|
+
draggable="true"
|
|
2064
|
+
@dragstart=${(o) => this.handleDragStart(o, t.name)}
|
|
2065
|
+
>
|
|
2066
|
+
<div class="tool-icon">${q(t.icon)}</div>
|
|
2067
|
+
<span>${t.label}</span>
|
|
2068
|
+
</div>
|
|
2069
|
+
`
|
|
2070
|
+
)}
|
|
2071
|
+
</div>
|
|
2072
|
+
|
|
2073
|
+
<p class="section-title" style="margin-top:20px;">Layout</p>
|
|
2074
|
+
<div class="layout-grid">
|
|
2075
|
+
${this.renderLayoutOption([1], "100%")}
|
|
2076
|
+
${this.renderLayoutOption([1, 1], "50/50")}
|
|
2077
|
+
${this.renderLayoutOption([1, 1, 1], "33/33/33")}
|
|
2078
|
+
${this.renderLayoutOption([2, 1], "66/33")}
|
|
2079
|
+
${this.renderLayoutOption([1, 2], "33/66")}
|
|
2080
|
+
${this.renderLayoutOption([1, 1, 1, 1], "25x4")}
|
|
2081
|
+
</div>
|
|
2082
|
+
`;
|
|
2083
|
+
}
|
|
2084
|
+
renderLayoutOption(e, t) {
|
|
2085
|
+
const o = e.reduce((n, i) => n + i, 0);
|
|
2086
|
+
return c`
|
|
2087
|
+
<div
|
|
2088
|
+
class="layout-item"
|
|
2089
|
+
draggable="true"
|
|
2090
|
+
@click=${() => this.addRowWithLayout(e)}
|
|
2091
|
+
@dragstart=${(n) => this.handleLayoutDragStart(n, e)}
|
|
2092
|
+
title=${t}
|
|
2093
|
+
>
|
|
2094
|
+
${e.map(
|
|
2095
|
+
(n) => c`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
|
|
2096
|
+
)}
|
|
2097
|
+
</div>
|
|
2098
|
+
`;
|
|
2099
|
+
}
|
|
2100
|
+
renderBlocksTab() {
|
|
2101
|
+
return c`
|
|
2102
|
+
<p style="color:#9ca3af;font-size:13px;text-align:center;margin-top:40px;">
|
|
2103
|
+
No saved blocks yet.<br/>Select a row in the editor and save it as a block.
|
|
2104
|
+
</p>
|
|
2105
|
+
`;
|
|
2106
|
+
}
|
|
2107
|
+
renderBodyTab() {
|
|
2108
|
+
return c`<me-body-settings .store=${this.store}></me-body-settings>`;
|
|
2109
|
+
}
|
|
2110
|
+
};
|
|
2111
|
+
I.styles = v`
|
|
2112
|
+
:host {
|
|
2113
|
+
display: flex;
|
|
2114
|
+
flex-direction: column;
|
|
2115
|
+
width: 280px;
|
|
2116
|
+
min-width: 280px;
|
|
2117
|
+
background: #ffffff;
|
|
2118
|
+
border-right: 1px solid #e5e7eb;
|
|
2119
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
2120
|
+
overflow-y: auto;
|
|
2121
|
+
}
|
|
2122
|
+
.tabs {
|
|
2123
|
+
display: flex;
|
|
2124
|
+
border-bottom: 1px solid #e5e7eb;
|
|
2125
|
+
background: #f9fafb;
|
|
2126
|
+
}
|
|
2127
|
+
.tab {
|
|
2128
|
+
flex: 1;
|
|
2129
|
+
padding: 10px 8px;
|
|
2130
|
+
border: none;
|
|
2131
|
+
background: none;
|
|
2132
|
+
cursor: pointer;
|
|
2133
|
+
font-size: 12px;
|
|
2134
|
+
font-weight: 500;
|
|
2135
|
+
color: #6b7280;
|
|
2136
|
+
text-align: center;
|
|
2137
|
+
transition: all 0.15s ease;
|
|
2138
|
+
border-bottom: 2px solid transparent;
|
|
2139
|
+
}
|
|
2140
|
+
.tab:hover {
|
|
2141
|
+
color: #374151;
|
|
2142
|
+
background: #f3f4f6;
|
|
2143
|
+
}
|
|
2144
|
+
.tab.active {
|
|
2145
|
+
color: #3b82f6;
|
|
2146
|
+
border-bottom-color: #3b82f6;
|
|
2147
|
+
}
|
|
2148
|
+
.tab-content {
|
|
2149
|
+
padding: 12px;
|
|
2150
|
+
flex: 1;
|
|
2151
|
+
}
|
|
2152
|
+
.section-title {
|
|
2153
|
+
font-size: 11px;
|
|
2154
|
+
font-weight: 600;
|
|
2155
|
+
text-transform: uppercase;
|
|
2156
|
+
color: #9ca3af;
|
|
2157
|
+
letter-spacing: 0.05em;
|
|
2158
|
+
margin: 0 0 8px 0;
|
|
2159
|
+
}
|
|
2160
|
+
.tool-grid {
|
|
2161
|
+
display: grid;
|
|
2162
|
+
grid-template-columns: 1fr 1fr;
|
|
2163
|
+
gap: 8px;
|
|
2164
|
+
}
|
|
2165
|
+
.tool-item {
|
|
2166
|
+
display: flex;
|
|
2167
|
+
flex-direction: column;
|
|
2168
|
+
align-items: center;
|
|
2169
|
+
gap: 6px;
|
|
2170
|
+
padding: 12px 8px;
|
|
2171
|
+
border: 1px solid #e5e7eb;
|
|
2172
|
+
border-radius: 6px;
|
|
2173
|
+
cursor: grab;
|
|
2174
|
+
background: white;
|
|
2175
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
2176
|
+
font-size: 12px;
|
|
2177
|
+
color: #374151;
|
|
2178
|
+
}
|
|
2179
|
+
.tool-item:hover {
|
|
2180
|
+
border-color: #3b82f6;
|
|
2181
|
+
background: #eff6ff;
|
|
2182
|
+
transform: translateY(-2px);
|
|
2183
|
+
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
|
|
2184
|
+
}
|
|
2185
|
+
.tool-item:hover .tool-icon {
|
|
2186
|
+
transform: scale(1.15);
|
|
2187
|
+
}
|
|
2188
|
+
.tool-item:active {
|
|
2189
|
+
transform: translateY(0px);
|
|
2190
|
+
box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
|
|
2191
|
+
}
|
|
2192
|
+
.tool-item:active {
|
|
2193
|
+
cursor: grabbing;
|
|
2194
|
+
}
|
|
2195
|
+
.tool-icon {
|
|
2196
|
+
width: 20px;
|
|
2197
|
+
height: 20px;
|
|
2198
|
+
display: flex;
|
|
2199
|
+
align-items: center;
|
|
2200
|
+
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
2201
|
+
justify-content: center;
|
|
2202
|
+
color: #6b7280;
|
|
2203
|
+
}
|
|
2204
|
+
.tool-icon svg {
|
|
2205
|
+
width: 20px;
|
|
2206
|
+
height: 20px;
|
|
2207
|
+
}
|
|
2208
|
+
.layout-grid {
|
|
2209
|
+
display: grid;
|
|
2210
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
2211
|
+
gap: 8px;
|
|
2212
|
+
margin-top: 16px;
|
|
2213
|
+
}
|
|
2214
|
+
.layout-item {
|
|
2215
|
+
display: flex;
|
|
2216
|
+
align-items: center;
|
|
2217
|
+
justify-content: center;
|
|
2218
|
+
gap: 2px;
|
|
2219
|
+
padding: 10px 4px;
|
|
2220
|
+
border: 1px solid #e5e7eb;
|
|
2221
|
+
border-radius: 6px;
|
|
2222
|
+
cursor: pointer;
|
|
2223
|
+
background: white;
|
|
2224
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
2225
|
+
}
|
|
2226
|
+
.layout-item:hover {
|
|
2227
|
+
border-color: #3b82f6;
|
|
2228
|
+
background: #eff6ff;
|
|
2229
|
+
transform: translateY(-2px);
|
|
2230
|
+
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
|
|
2231
|
+
}
|
|
2232
|
+
.layout-item:hover .layout-col {
|
|
2233
|
+
background: #93c5fd;
|
|
2234
|
+
}
|
|
2235
|
+
.layout-item:active {
|
|
2236
|
+
transform: translateY(0px);
|
|
2237
|
+
}
|
|
2238
|
+
.layout-col {
|
|
2239
|
+
height: 20px;
|
|
2240
|
+
background: #d1d5db;
|
|
2241
|
+
border-radius: 2px;
|
|
2242
|
+
transition: background 0.2s ease;
|
|
2243
|
+
}
|
|
2244
|
+
`;
|
|
2245
|
+
Y([
|
|
2246
|
+
b({ attribute: !1 })
|
|
2247
|
+
], I.prototype, "store", 1);
|
|
2248
|
+
Y([
|
|
2249
|
+
b({ attribute: !1 })
|
|
2250
|
+
], I.prototype, "toolRegistry", 2);
|
|
2251
|
+
I = Y([
|
|
2252
|
+
$("me-editor-sidebar")
|
|
2253
|
+
], I);
|
|
2254
|
+
function Ht(e, t, o) {
|
|
2255
|
+
const n = e && /^#[0-9a-fA-F]{3,8}$/.test(e) ? e : "#000000";
|
|
2256
|
+
return c`
|
|
2257
|
+
<div class="prop-row">
|
|
2258
|
+
<label class="prop-label">${o}</label>
|
|
2259
|
+
<div class="prop-color">
|
|
2260
|
+
<input class="color-swatch" type="color" .value=${n}
|
|
2261
|
+
@input=${(i) => t(i.target.value)} />
|
|
2262
|
+
<input class="prop-input" type="text" .value=${e ?? ""} style="flex:1;"
|
|
2263
|
+
@change=${(i) => t(i.target.value)} />
|
|
2264
|
+
</div>
|
|
2265
|
+
</div>
|
|
2266
|
+
`;
|
|
2267
|
+
}
|
|
2268
|
+
function jt(e, t, o, n) {
|
|
2269
|
+
const i = n?.options || [];
|
|
2270
|
+
return c`
|
|
2271
|
+
<div class="prop-row">
|
|
2272
|
+
<label class="prop-label">${o}</label>
|
|
2273
|
+
<select class="prop-input" @change=${(r) => t(r.target.value)}>
|
|
2274
|
+
${i.map((r) => c`<option value=${r.value} ?selected=${e === r.value}>${r.label}</option>`)}
|
|
2275
|
+
</select>
|
|
2276
|
+
</div>
|
|
2277
|
+
`;
|
|
2278
|
+
}
|
|
2279
|
+
function Wt(e, t, o) {
|
|
2280
|
+
return c`
|
|
2281
|
+
<div class="prop-row">
|
|
2282
|
+
<label class="prop-label">${o}</label>
|
|
2283
|
+
<div style="display:flex;gap:2px;">
|
|
2284
|
+
${["left", "center", "right"].map((n) => c`
|
|
2285
|
+
<button
|
|
2286
|
+
style="flex:1;padding:6px;border:1px solid ${e === n ? "#3b82f6" : "#d1d5db"};background:${e === n ? "#eff6ff" : "white"};border-radius:4px;cursor:pointer;font-size:11px;text-transform:capitalize;color:${e === n ? "#3b82f6" : "#6b7280"};"
|
|
2287
|
+
@click=${() => t(n)}
|
|
2288
|
+
>${n}</button>
|
|
2289
|
+
`)}
|
|
2290
|
+
</div>
|
|
2291
|
+
</div>
|
|
2292
|
+
`;
|
|
2293
|
+
}
|
|
2294
|
+
function Ut(e) {
|
|
2295
|
+
const t = (e || "0px").split(/\s+/).map((s) => parseInt(s) || 0), o = t[0], n = t[1] ?? o, i = t[2] ?? o, r = t[3] ?? n;
|
|
2296
|
+
return [o, n, i, r];
|
|
2297
|
+
}
|
|
2298
|
+
function Ft(e, t, o, n) {
|
|
2299
|
+
return e === t && t === o && o === n ? `${e}px` : e === o && t === n ? `${e}px ${t}px` : `${e}px ${t}px ${o}px ${n}px`;
|
|
2300
|
+
}
|
|
2301
|
+
function Nt(e, t, o) {
|
|
2302
|
+
const [n, i, r, s] = Ut(e), a = (p, h, g, u) => t(Ft(p, h, g, u));
|
|
2303
|
+
return c`
|
|
2304
|
+
<div class="prop-row">
|
|
2305
|
+
<label class="prop-label">${o}</label>
|
|
2306
|
+
<div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;">
|
|
2307
|
+
${[
|
|
2308
|
+
{ label: "T", val: n, change: (p) => a(p, i, r, s) },
|
|
2309
|
+
{ label: "R", val: i, change: (p) => a(n, p, r, s) },
|
|
2310
|
+
{ label: "B", val: r, change: (p) => a(n, i, p, s) },
|
|
2311
|
+
{ label: "L", val: s, change: (p) => a(n, i, r, p) }
|
|
2312
|
+
].map((p) => c`
|
|
2313
|
+
<div style="display:flex;align-items:center;gap:4px;">
|
|
2314
|
+
<span style="font-size:10px;color:#9ca3af;width:12px;">${p.label}</span>
|
|
2315
|
+
<input type="number" .value=${p.val} min="0"
|
|
2316
|
+
@change=${(h) => p.change(parseInt(h.target.value) || 0)}
|
|
2317
|
+
style="flex:1;padding:4px 6px;border:1px solid #d1d5db;border-radius:3px;font-size:12px;width:50px;" />
|
|
2318
|
+
</div>
|
|
2319
|
+
`)}
|
|
2320
|
+
</div>
|
|
2321
|
+
</div>
|
|
2322
|
+
`;
|
|
2323
|
+
}
|
|
2324
|
+
function qt(e, t, o) {
|
|
2325
|
+
return c`
|
|
2326
|
+
<div class="prop-row">
|
|
2327
|
+
<div class="prop-toggle">
|
|
2328
|
+
<input type="checkbox" .checked=${!!e}
|
|
2329
|
+
@change=${(n) => t(n.target.checked)} />
|
|
2330
|
+
<label class="prop-label" style="margin:0;">${o}</label>
|
|
2331
|
+
</div>
|
|
2332
|
+
</div>
|
|
2333
|
+
`;
|
|
2334
|
+
}
|
|
2335
|
+
function Gt(e, t, o) {
|
|
2336
|
+
return c`
|
|
2337
|
+
<div class="prop-row">
|
|
2338
|
+
<label class="prop-label">${o}</label>
|
|
2339
|
+
<input class="prop-input" type="text" .value=${e ?? ""}
|
|
2340
|
+
@change=${(n) => t(n.target.value)} />
|
|
2341
|
+
</div>
|
|
2342
|
+
`;
|
|
2343
|
+
}
|
|
2344
|
+
function Yt(e, t, o) {
|
|
2345
|
+
return c`
|
|
2346
|
+
<div class="prop-row">
|
|
2347
|
+
<label class="prop-label">${o}</label>
|
|
2348
|
+
<textarea class="prop-input"
|
|
2349
|
+
style="min-height:100px;font-family:'SF Mono',Menlo,monospace;font-size:12px;"
|
|
2350
|
+
.value=${e ?? ""}
|
|
2351
|
+
@change=${(n) => t(n.target.value)}
|
|
2352
|
+
></textarea>
|
|
2353
|
+
</div>
|
|
2354
|
+
`;
|
|
2355
|
+
}
|
|
2356
|
+
var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, K = (e, t, o, n) => {
|
|
2357
|
+
for (var i = n > 1 ? void 0 : n ? Jt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
2358
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
2359
|
+
return n && i && Kt(t, o, i), i;
|
|
1427
2360
|
};
|
|
1428
|
-
let
|
|
2361
|
+
let P = class extends w {
|
|
1429
2362
|
constructor() {
|
|
1430
|
-
super(...arguments), this.
|
|
2363
|
+
super(...arguments), this.storeCtrl = new R(this, ["design", "selection"]);
|
|
2364
|
+
}
|
|
2365
|
+
set store(e) {
|
|
2366
|
+
this.storeCtrl.setStore(e);
|
|
2367
|
+
}
|
|
2368
|
+
get store() {
|
|
2369
|
+
return this.storeCtrl.store;
|
|
2370
|
+
}
|
|
2371
|
+
/** Create a change handler bound to a specific content ID and property key */
|
|
2372
|
+
onChange(e, t) {
|
|
2373
|
+
return (o) => {
|
|
2374
|
+
this.store.updateContentValues(e, { [t]: o });
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
render() {
|
|
2378
|
+
const e = this.store.selectedId;
|
|
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);
|
|
2382
|
+
if (!t)
|
|
2383
|
+
return c`<div class="no-selection">Select an element to edit its properties</div>`;
|
|
2384
|
+
const o = this.toolRegistry.get(t.type);
|
|
2385
|
+
return o ? c`
|
|
2386
|
+
<div class="header">
|
|
2387
|
+
<p class="header-title">${o.label}</p>
|
|
2388
|
+
<p class="header-type">${t.type}</p>
|
|
2389
|
+
</div>
|
|
2390
|
+
${Object.entries(o.options).map(([, n]) => this.renderGroup(t, n))}
|
|
2391
|
+
` : c`<div class="no-selection">Unknown tool: ${t.type}</div>`;
|
|
2392
|
+
}
|
|
2393
|
+
renderGroup(e, t) {
|
|
2394
|
+
return c`
|
|
2395
|
+
<div class="group">
|
|
2396
|
+
<div class="group-title">${t.title}</div>
|
|
2397
|
+
<div class="group-body">
|
|
2398
|
+
${Object.entries(t.options).map(
|
|
2399
|
+
([o, n]) => this.renderWidget(e, o, n)
|
|
2400
|
+
)}
|
|
2401
|
+
</div>
|
|
2402
|
+
</div>
|
|
2403
|
+
`;
|
|
2404
|
+
}
|
|
2405
|
+
/** Delegate to the correct widget function based on the property's widget type */
|
|
2406
|
+
renderWidget(e, t, o) {
|
|
2407
|
+
const n = e.values[t] ?? o.defaultValue, i = this.onChange(e.id, t);
|
|
2408
|
+
switch (o.widget) {
|
|
2409
|
+
case "color_picker":
|
|
2410
|
+
return Ht(n, i, o.label);
|
|
2411
|
+
case "toggle":
|
|
2412
|
+
return qt(n, i, o.label);
|
|
2413
|
+
case "rich_text":
|
|
2414
|
+
return Yt(n, i, o.label);
|
|
2415
|
+
case "dropdown":
|
|
2416
|
+
return jt(n, i, o.label, o.widgetParams);
|
|
2417
|
+
case "alignment":
|
|
2418
|
+
return Wt(n, i, o.label);
|
|
2419
|
+
case "padding":
|
|
2420
|
+
return Nt(n, i, o.label);
|
|
2421
|
+
case "text":
|
|
2422
|
+
default:
|
|
2423
|
+
return Gt(n, i, o.label);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
P.styles = v`
|
|
2428
|
+
:host {
|
|
2429
|
+
display: flex; flex-direction: column; width: 300px; min-width: 300px;
|
|
2430
|
+
background: #fff; border-left: 1px solid #e5e7eb;
|
|
2431
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
2432
|
+
overflow-y: auto;
|
|
2433
|
+
}
|
|
2434
|
+
.header { padding: 12px 16px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
|
|
2435
|
+
.header-title { font-size: 14px; font-weight: 600; color: #111827; margin: 0; }
|
|
2436
|
+
.header-type { font-size: 11px; color: #9ca3af; text-transform: uppercase; margin: 2px 0 0 0; }
|
|
2437
|
+
.no-selection {
|
|
2438
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
2439
|
+
flex: 1; color: #9ca3af; font-size: 13px; gap: 8px; padding: 40px 20px; text-align: center;
|
|
2440
|
+
}
|
|
2441
|
+
.group { border-bottom: 1px solid #f3f4f6; }
|
|
2442
|
+
.group-title {
|
|
2443
|
+
padding: 10px 16px; font-size: 12px; font-weight: 600; color: #6b7280;
|
|
2444
|
+
background: #f9fafb; cursor: pointer; user-select: none;
|
|
2445
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
2446
|
+
}
|
|
2447
|
+
.group-title:hover { background: #f3f4f6; }
|
|
2448
|
+
.group-body { padding: 12px 16px; }
|
|
2449
|
+
.prop-row { margin-bottom: 12px; }
|
|
2450
|
+
.prop-label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
|
|
2451
|
+
.prop-input {
|
|
2452
|
+
width: 100%; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px;
|
|
2453
|
+
font-size: 13px; color: #111827; background: white; box-sizing: border-box;
|
|
2454
|
+
}
|
|
2455
|
+
.prop-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
|
|
2456
|
+
.prop-toggle { display: flex; align-items: center; gap: 8px; }
|
|
2457
|
+
.prop-color { display: flex; align-items: center; gap: 8px; }
|
|
2458
|
+
.color-swatch { width: 28px; height: 28px; border-radius: 4px; border: 1px solid #d1d5db; cursor: pointer; padding: 0; }
|
|
2459
|
+
textarea.prop-input { min-height: 80px; resize: vertical; font-family: monospace; }
|
|
2460
|
+
`;
|
|
2461
|
+
K([
|
|
2462
|
+
b({ attribute: !1 })
|
|
2463
|
+
], P.prototype, "store", 1);
|
|
2464
|
+
K([
|
|
2465
|
+
b({ attribute: !1 })
|
|
2466
|
+
], P.prototype, "toolRegistry", 2);
|
|
2467
|
+
P = K([
|
|
2468
|
+
$("me-property-panel")
|
|
2469
|
+
], P);
|
|
2470
|
+
var Xt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, nt = (e, t, o, n) => {
|
|
2471
|
+
for (var i = n > 1 ? void 0 : n ? Qt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
|
|
2472
|
+
(s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
|
|
2473
|
+
return n && i && Xt(t, o, i), i;
|
|
2474
|
+
};
|
|
2475
|
+
let L = class extends w {
|
|
2476
|
+
constructor() {
|
|
2477
|
+
super(...arguments), this.options = {}, this.store = new ut(), this.toolRegistry = new gt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
|
|
1431
2478
|
const t = e.metaKey || e.ctrlKey, n = e.composedPath().some((i) => {
|
|
1432
2479
|
const r = i?.tagName;
|
|
1433
2480
|
return r === "INPUT" || r === "TEXTAREA" || r === "SELECT";
|
|
@@ -1439,7 +2486,7 @@ let _ = class extends L {
|
|
|
1439
2486
|
super.connectedCallback(), this.registerBuiltInTools(), this.applyOptions(), this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this._handleKeydown);
|
|
1440
2487
|
}
|
|
1441
2488
|
firstUpdated() {
|
|
1442
|
-
this.dragManager = new
|
|
2489
|
+
this.dragManager = new bt(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
|
|
1443
2490
|
this.dispatchEvent(new CustomEvent("design:loaded", { detail: e, bubbles: !0, composed: !0 }));
|
|
1444
2491
|
}), this.store.events.on("design:updated", (e) => {
|
|
1445
2492
|
this.dispatchEvent(new CustomEvent("design:updated", { detail: e, bubbles: !0, composed: !0 }));
|
|
@@ -1460,8 +2507,8 @@ let _ = class extends L {
|
|
|
1460
2507
|
exportHtml(e, t) {
|
|
1461
2508
|
const o = this.store.getDesign(), n = /* @__PURE__ */ new Set();
|
|
1462
2509
|
for (const r of o.body.rows)
|
|
1463
|
-
for (const
|
|
1464
|
-
for (const a of
|
|
2510
|
+
for (const s of r.columns)
|
|
2511
|
+
for (const a of s.contents)
|
|
1465
2512
|
n.add(a.type);
|
|
1466
2513
|
const i = Array.from(n).filter((r) => !this.toolRegistry.isLoaded(r)).map((r) => this.toolRegistry.ensureLoaded(r));
|
|
1467
2514
|
i.length > 0 ? Promise.all(i).then(() => this.doExport(o, e, t)) : this.doExport(o, e, t);
|
|
@@ -1469,8 +2516,8 @@ let _ = class extends L {
|
|
|
1469
2516
|
doExport(e, t, o) {
|
|
1470
2517
|
const n = /* @__PURE__ */ new Map();
|
|
1471
2518
|
for (const i of this.toolRegistry.getAll())
|
|
1472
|
-
n.set(i.name, (r,
|
|
1473
|
-
t(
|
|
2519
|
+
n.set(i.name, (r, s) => i.renderer.renderHtml(r, s));
|
|
2520
|
+
t(Rt(e, n, o));
|
|
1474
2521
|
}
|
|
1475
2522
|
async exportHtmlAsync(e) {
|
|
1476
2523
|
return new Promise((t) => this.exportHtml(t, e));
|
|
@@ -1506,22 +2553,22 @@ let _ = class extends L {
|
|
|
1506
2553
|
*/
|
|
1507
2554
|
preloadLazyTools() {
|
|
1508
2555
|
const e = window.requestIdleCallback ?? ((t) => setTimeout(t, 1e3));
|
|
1509
|
-
for (const { meta: t } of
|
|
2556
|
+
for (const { meta: t } of Z)
|
|
1510
2557
|
e(() => {
|
|
1511
2558
|
this.toolRegistry.ensureLoaded(t.name);
|
|
1512
2559
|
});
|
|
1513
2560
|
}
|
|
1514
2561
|
registerBuiltInTools() {
|
|
1515
|
-
for (const e of
|
|
2562
|
+
for (const e of kt)
|
|
1516
2563
|
this.toolRegistry.register(e);
|
|
1517
|
-
for (const { meta: e, loader: t } of
|
|
2564
|
+
for (const { meta: e, loader: t } of Z)
|
|
1518
2565
|
this.toolRegistry.registerLazy(e, t);
|
|
1519
2566
|
}
|
|
1520
2567
|
applyOptions() {
|
|
1521
2568
|
this.options.design && this.store.loadDesign(this.options.design);
|
|
1522
2569
|
}
|
|
1523
2570
|
render() {
|
|
1524
|
-
return
|
|
2571
|
+
return c`
|
|
1525
2572
|
<me-editor-sidebar
|
|
1526
2573
|
.store=${this.store}
|
|
1527
2574
|
.toolRegistry=${this.toolRegistry}
|
|
@@ -1537,7 +2584,7 @@ let _ = class extends L {
|
|
|
1537
2584
|
`;
|
|
1538
2585
|
}
|
|
1539
2586
|
};
|
|
1540
|
-
|
|
2587
|
+
L.styles = v`
|
|
1541
2588
|
:host {
|
|
1542
2589
|
display: flex;
|
|
1543
2590
|
width: 100%;
|
|
@@ -1552,18 +2599,31 @@ _.styles = z`
|
|
|
1552
2599
|
}
|
|
1553
2600
|
* { box-sizing: border-box; }
|
|
1554
2601
|
`;
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
],
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
],
|
|
2602
|
+
nt([
|
|
2603
|
+
b({ type: Object })
|
|
2604
|
+
], L.prototype, "options", 2);
|
|
2605
|
+
L = nt([
|
|
2606
|
+
$("mail-editor")
|
|
2607
|
+
], L);
|
|
2608
|
+
function k(e, t) {
|
|
2609
|
+
customElements.get(e) || customElements.define(e, t);
|
|
2610
|
+
}
|
|
2611
|
+
k("mail-editor", L);
|
|
2612
|
+
k("me-editor-canvas", T);
|
|
2613
|
+
k("me-row-renderer", D);
|
|
2614
|
+
k("me-column-renderer", y);
|
|
2615
|
+
k("me-content-renderer", _);
|
|
2616
|
+
k("me-editor-sidebar", I);
|
|
2617
|
+
k("me-body-settings", E);
|
|
2618
|
+
k("me-property-panel", P);
|
|
2619
|
+
const ne = customElements.get("mail-editor") !== void 0;
|
|
1561
2620
|
export {
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
2621
|
+
ne as E,
|
|
2622
|
+
L as M,
|
|
2623
|
+
gt as T,
|
|
2624
|
+
ut as a,
|
|
2625
|
+
M as e,
|
|
2626
|
+
oe as j,
|
|
2627
|
+
l as s
|
|
1568
2628
|
};
|
|
1569
|
-
//# sourceMappingURL=
|
|
2629
|
+
//# sourceMappingURL=index-DV_tofKb.js.map
|