@lit-pigeon/core 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -17
- package/dist/gallery.cjs +1 -0
- package/dist/gallery.d.ts +317 -0
- package/dist/gallery.js +407 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +212 -12
- package/dist/index.js +373 -265
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { produce as
|
|
2
|
-
import { nanoid as
|
|
3
|
-
class
|
|
1
|
+
import { produce as B } from "immer";
|
|
2
|
+
import { nanoid as V } from "nanoid";
|
|
3
|
+
class D {
|
|
4
4
|
constructor(t) {
|
|
5
5
|
this._steps = [], this._selection = null, this._selectionSet = !1, this._meta = /* @__PURE__ */ new Map(), this._doc = t;
|
|
6
6
|
}
|
|
@@ -37,7 +37,7 @@ function m(o, t, e, n) {
|
|
|
37
37
|
type: o,
|
|
38
38
|
path: t,
|
|
39
39
|
apply(r) {
|
|
40
|
-
return
|
|
40
|
+
return B(r, e);
|
|
41
41
|
},
|
|
42
42
|
invert(r) {
|
|
43
43
|
return m(`${o}:invert`, t, n, e);
|
|
@@ -45,12 +45,12 @@ function m(o, t, e, n) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function g() {
|
|
48
|
-
return
|
|
48
|
+
return V(10);
|
|
49
49
|
}
|
|
50
50
|
function h(o = 0) {
|
|
51
51
|
return { top: o, right: o, bottom: o, left: o };
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function O() {
|
|
54
54
|
return {
|
|
55
55
|
content: "<p>Enter your text here</p>",
|
|
56
56
|
padding: h(10),
|
|
@@ -58,7 +58,7 @@ function V() {
|
|
|
58
58
|
textAlign: "left"
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function j() {
|
|
62
62
|
return {
|
|
63
63
|
src: "",
|
|
64
64
|
alt: "",
|
|
@@ -67,7 +67,7 @@ function P() {
|
|
|
67
67
|
alignment: "center"
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function z() {
|
|
71
71
|
return {
|
|
72
72
|
content: "<p>Click me</p>",
|
|
73
73
|
href: "#",
|
|
@@ -82,7 +82,7 @@ function D() {
|
|
|
82
82
|
fullWidth: !1
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function N() {
|
|
86
86
|
return {
|
|
87
87
|
borderColor: "#e2e8f0",
|
|
88
88
|
borderWidth: 1,
|
|
@@ -91,10 +91,10 @@ function L() {
|
|
|
91
91
|
width: "100%"
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function q() {
|
|
95
95
|
return { height: 20 };
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function U() {
|
|
98
98
|
return {
|
|
99
99
|
icons: [],
|
|
100
100
|
iconSize: 32,
|
|
@@ -103,13 +103,13 @@ function j() {
|
|
|
103
103
|
padding: h(10)
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function F() {
|
|
107
107
|
return {
|
|
108
108
|
content: "",
|
|
109
109
|
padding: h(0)
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function G() {
|
|
113
113
|
return {
|
|
114
114
|
backgroundUrl: "",
|
|
115
115
|
backgroundPosition: "center center",
|
|
@@ -123,7 +123,7 @@ function N() {
|
|
|
123
123
|
content: '<p style="color:#ffffff;font-size:24px;">Hero Title</p>'
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function K() {
|
|
127
127
|
return {
|
|
128
128
|
links: [
|
|
129
129
|
{ href: "#", text: "Home" },
|
|
@@ -138,36 +138,36 @@ function q() {
|
|
|
138
138
|
linkPadding: "10px 15px"
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
text:
|
|
143
|
-
image:
|
|
144
|
-
button:
|
|
145
|
-
divider:
|
|
146
|
-
spacer:
|
|
147
|
-
social:
|
|
148
|
-
html:
|
|
149
|
-
hero:
|
|
150
|
-
navbar:
|
|
141
|
+
const E = {
|
|
142
|
+
text: O,
|
|
143
|
+
image: j,
|
|
144
|
+
button: z,
|
|
145
|
+
divider: N,
|
|
146
|
+
spacer: q,
|
|
147
|
+
social: U,
|
|
148
|
+
html: F,
|
|
149
|
+
hero: G,
|
|
150
|
+
navbar: K
|
|
151
151
|
};
|
|
152
152
|
function w(o) {
|
|
153
|
-
const t =
|
|
153
|
+
const t = E[o];
|
|
154
154
|
if (!t)
|
|
155
155
|
throw new Error(`Unknown block type: ${o}`);
|
|
156
156
|
return t();
|
|
157
157
|
}
|
|
158
|
-
let
|
|
159
|
-
function
|
|
160
|
-
|
|
158
|
+
let v = null;
|
|
159
|
+
function Y(o) {
|
|
160
|
+
v = o;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const e =
|
|
162
|
+
function Ct(o, t) {
|
|
163
|
+
const e = E[o];
|
|
164
164
|
if (e)
|
|
165
165
|
return {
|
|
166
166
|
id: g(),
|
|
167
167
|
type: o,
|
|
168
168
|
values: { ...e(), ...t }
|
|
169
169
|
};
|
|
170
|
-
const n =
|
|
170
|
+
const n = v == null ? void 0 : v(o);
|
|
171
171
|
if (n)
|
|
172
172
|
return {
|
|
173
173
|
id: g(),
|
|
@@ -176,7 +176,7 @@ function gt(o, t) {
|
|
|
176
176
|
};
|
|
177
177
|
throw new Error(`Unknown block type: ${o}`);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function M(o = []) {
|
|
180
180
|
return {
|
|
181
181
|
id: g(),
|
|
182
182
|
type: "column",
|
|
@@ -187,8 +187,8 @@ function B(o = []) {
|
|
|
187
187
|
blocks: o
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
const e = o ?? [
|
|
190
|
+
function Rt(o, t) {
|
|
191
|
+
const e = o ?? [M()], n = t ?? e.map(() => Math.floor(12 / e.length));
|
|
192
192
|
return {
|
|
193
193
|
id: g(),
|
|
194
194
|
type: "row",
|
|
@@ -201,7 +201,7 @@ function ht(o, t) {
|
|
|
201
201
|
locked: !1
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function X(o = "Untitled") {
|
|
205
205
|
const t = (/* @__PURE__ */ new Date()).toISOString();
|
|
206
206
|
return {
|
|
207
207
|
version: "1.0",
|
|
@@ -221,18 +221,18 @@ function F(o = "Untitled") {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class _ {
|
|
225
225
|
constructor(t, e, n, r) {
|
|
226
226
|
this.doc = t, this.selection = e, this.plugins = n, this._pluginList = r;
|
|
227
227
|
}
|
|
228
228
|
static create(t = {}) {
|
|
229
|
-
const e = t.doc ??
|
|
229
|
+
const e = t.doc ?? X(), n = t.plugins ?? [], r = /* @__PURE__ */ new Map(), s = new _(e, null, r, n);
|
|
230
230
|
for (const i of n)
|
|
231
231
|
i.init && r.set(i.name, i.init(s));
|
|
232
232
|
return s;
|
|
233
233
|
}
|
|
234
234
|
createTransaction() {
|
|
235
|
-
return new
|
|
235
|
+
return new D(this.doc);
|
|
236
236
|
}
|
|
237
237
|
apply(t) {
|
|
238
238
|
let e = t.doc;
|
|
@@ -242,10 +242,10 @@ class S {
|
|
|
242
242
|
const l = r.get(i.name);
|
|
243
243
|
r.set(i.name, i.apply(t, l));
|
|
244
244
|
}
|
|
245
|
-
t.steps.length > 0 && !t.getMeta("skipTimestamp") && (e =
|
|
245
|
+
t.steps.length > 0 && !t.getMeta("skipTimestamp") && (e = B(e, (i) => {
|
|
246
246
|
i.metadata.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
247
247
|
}));
|
|
248
|
-
const s = new
|
|
248
|
+
const s = new _(e, n, r, this._pluginList);
|
|
249
249
|
for (const i of this._pluginList)
|
|
250
250
|
i.onStateChange && i.onStateChange(s, this);
|
|
251
251
|
return s;
|
|
@@ -254,30 +254,118 @@ class S {
|
|
|
254
254
|
return this.plugins.get(t);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function C(o, t, e) {
|
|
258
258
|
return { type: "block", rowId: o, columnId: t, blockId: e };
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function R(o) {
|
|
261
261
|
return { type: "row", rowId: o };
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Tt(o, t) {
|
|
264
264
|
return { type: "column", rowId: o, columnId: t };
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function $t() {
|
|
267
267
|
return { type: "body" };
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Bt(o, t) {
|
|
270
270
|
return o === t ? !0 : !o || !t ? !1 : o.type === t.type && o.rowId === t.rowId && o.columnId === t.columnId && o.blockId === t.blockId;
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
const k = /* @__PURE__ */ new Map(), Z = [
|
|
273
|
+
{
|
|
274
|
+
type: "text",
|
|
275
|
+
label: "Text",
|
|
276
|
+
icon: "text",
|
|
277
|
+
defaultValues: w("text")
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
type: "image",
|
|
281
|
+
label: "Image",
|
|
282
|
+
icon: "image",
|
|
283
|
+
defaultValues: w("image")
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: "button",
|
|
287
|
+
label: "Button",
|
|
288
|
+
icon: "button",
|
|
289
|
+
defaultValues: w("button")
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
type: "divider",
|
|
293
|
+
label: "Divider",
|
|
294
|
+
icon: "divider",
|
|
295
|
+
defaultValues: w("divider")
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
type: "spacer",
|
|
299
|
+
label: "Spacer",
|
|
300
|
+
icon: "spacer",
|
|
301
|
+
defaultValues: w("spacer")
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: "social",
|
|
305
|
+
label: "Social",
|
|
306
|
+
icon: "social",
|
|
307
|
+
defaultValues: w("social")
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
type: "html",
|
|
311
|
+
label: "HTML",
|
|
312
|
+
icon: "html",
|
|
313
|
+
defaultValues: w("html")
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
type: "hero",
|
|
317
|
+
label: "Hero",
|
|
318
|
+
icon: "hero",
|
|
319
|
+
defaultValues: w("hero")
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
type: "navbar",
|
|
323
|
+
label: "Navbar",
|
|
324
|
+
icon: "navbar",
|
|
325
|
+
defaultValues: w("navbar")
|
|
326
|
+
}
|
|
327
|
+
];
|
|
328
|
+
function J() {
|
|
329
|
+
for (const o of Z)
|
|
330
|
+
k.set(o.type, o);
|
|
331
|
+
Y((o) => {
|
|
332
|
+
var t;
|
|
333
|
+
return (t = k.get(o)) == null ? void 0 : t.defaultValues;
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
function Q(o) {
|
|
337
|
+
k.set(o.type, o);
|
|
338
|
+
}
|
|
339
|
+
function Et(o) {
|
|
340
|
+
return k.get(o);
|
|
341
|
+
}
|
|
342
|
+
function tt() {
|
|
343
|
+
return Array.from(k.values());
|
|
344
|
+
}
|
|
345
|
+
let I;
|
|
346
|
+
function Mt(o) {
|
|
347
|
+
I = o ? [...o] : void 0;
|
|
348
|
+
}
|
|
349
|
+
function et(o) {
|
|
350
|
+
return I ? I.includes(o) : !0;
|
|
351
|
+
}
|
|
352
|
+
function Lt() {
|
|
353
|
+
return I ? I.map((o) => k.get(o)).filter((o) => o !== void 0) : tt();
|
|
354
|
+
}
|
|
355
|
+
function Wt(o) {
|
|
356
|
+
return k.has(o);
|
|
357
|
+
}
|
|
358
|
+
J();
|
|
359
|
+
function x(o, t, e) {
|
|
273
360
|
const n = o.body.rows.findIndex((s) => s.id === t);
|
|
274
|
-
if (n === -1) return null;
|
|
361
|
+
if (n === -1 || o.body.rows[n].locked) return null;
|
|
275
362
|
const r = o.body.rows[n].columns.findIndex((s) => s.id === e);
|
|
276
363
|
return r === -1 ? null : { rowIndex: n, columnIndex: r };
|
|
277
364
|
}
|
|
278
|
-
function
|
|
365
|
+
function Ht(o, t, e, n) {
|
|
279
366
|
return (r, s) => {
|
|
280
|
-
|
|
367
|
+
if (!et(e.type)) return !1;
|
|
368
|
+
const i = x(r.doc, o, t);
|
|
281
369
|
if (!i) return !1;
|
|
282
370
|
const l = r.doc.body.rows[i.rowIndex].columns[i.columnIndex], c = n ?? l.blocks.length;
|
|
283
371
|
if (s) {
|
|
@@ -291,14 +379,14 @@ function xt(o, t, e, n) {
|
|
|
291
379
|
d.body.rows[i.rowIndex].columns[i.columnIndex].blocks.splice(c, 1);
|
|
292
380
|
}
|
|
293
381
|
);
|
|
294
|
-
a.addStep(u), a.setSelection(
|
|
382
|
+
a.addStep(u), a.setSelection(C(o, t, e.id)), s(a);
|
|
295
383
|
}
|
|
296
384
|
return !0;
|
|
297
385
|
};
|
|
298
386
|
}
|
|
299
|
-
function
|
|
387
|
+
function Pt(o, t, e) {
|
|
300
388
|
return (n, r) => {
|
|
301
|
-
const s =
|
|
389
|
+
const s = x(n.doc, o, t);
|
|
302
390
|
if (!s) return !1;
|
|
303
391
|
const i = n.doc.body.rows[s.rowIndex].columns[s.columnIndex], l = i.blocks.findIndex((c) => c.id === e);
|
|
304
392
|
if (l === -1) return !1;
|
|
@@ -322,9 +410,9 @@ function It(o, t, e) {
|
|
|
322
410
|
return !0;
|
|
323
411
|
};
|
|
324
412
|
}
|
|
325
|
-
function
|
|
413
|
+
function Vt(o, t, e, n) {
|
|
326
414
|
return (r, s) => {
|
|
327
|
-
const i =
|
|
415
|
+
const i = x(r.doc, o, t);
|
|
328
416
|
if (!i) return !1;
|
|
329
417
|
const l = r.doc.body.rows[i.rowIndex].columns[i.columnIndex], c = l.blocks.findIndex((a) => a.id === e);
|
|
330
418
|
if (c === -1) return !1;
|
|
@@ -345,35 +433,35 @@ function vt(o, t, e, n) {
|
|
|
345
433
|
return !0;
|
|
346
434
|
};
|
|
347
435
|
}
|
|
348
|
-
function
|
|
436
|
+
function Dt(o, t, e, n, r, s) {
|
|
349
437
|
return (i, l) => {
|
|
350
|
-
const c =
|
|
438
|
+
const c = x(i.doc, o, t);
|
|
351
439
|
if (!c) return !1;
|
|
352
440
|
const u = i.doc.body.rows[c.rowIndex].columns[c.columnIndex].blocks.findIndex((p) => p.id === e);
|
|
353
441
|
if (u === -1) return !1;
|
|
354
|
-
const d =
|
|
442
|
+
const d = x(i.doc, n, r);
|
|
355
443
|
if (!d) return !1;
|
|
356
444
|
if (l) {
|
|
357
445
|
const p = i.createTransaction(), b = m(
|
|
358
446
|
"moveBlock",
|
|
359
447
|
"body.rows",
|
|
360
448
|
(y) => {
|
|
361
|
-
const [
|
|
362
|
-
y.body.rows[d.rowIndex].columns[d.columnIndex].blocks.splice(s, 0,
|
|
449
|
+
const [S] = y.body.rows[c.rowIndex].columns[c.columnIndex].blocks.splice(u, 1);
|
|
450
|
+
y.body.rows[d.rowIndex].columns[d.columnIndex].blocks.splice(s, 0, S);
|
|
363
451
|
},
|
|
364
452
|
(y) => {
|
|
365
|
-
const [
|
|
366
|
-
y.body.rows[c.rowIndex].columns[c.columnIndex].blocks.splice(u, 0,
|
|
453
|
+
const [S] = y.body.rows[d.rowIndex].columns[d.columnIndex].blocks.splice(s, 1);
|
|
454
|
+
y.body.rows[c.rowIndex].columns[c.columnIndex].blocks.splice(u, 0, S);
|
|
367
455
|
}
|
|
368
456
|
);
|
|
369
|
-
p.addStep(b), p.setSelection(
|
|
457
|
+
p.addStep(b), p.setSelection(C(n, r, e)), l(p);
|
|
370
458
|
}
|
|
371
459
|
return !0;
|
|
372
460
|
};
|
|
373
461
|
}
|
|
374
|
-
function
|
|
462
|
+
function Ot(o, t, e) {
|
|
375
463
|
return (n, r) => {
|
|
376
|
-
const s =
|
|
464
|
+
const s = x(n.doc, o, t);
|
|
377
465
|
if (!s) return !1;
|
|
378
466
|
const i = n.doc.body.rows[s.rowIndex].columns[s.columnIndex], l = i.blocks.findIndex((c) => c.id === e);
|
|
379
467
|
if (l === -1) return !1;
|
|
@@ -390,12 +478,12 @@ function At(o, t, e) {
|
|
|
390
478
|
y.body.rows[s.rowIndex].columns[s.columnIndex].blocks.splice(d, 1);
|
|
391
479
|
}
|
|
392
480
|
);
|
|
393
|
-
p.addStep(b), p.setSelection(
|
|
481
|
+
p.addStep(b), p.setSelection(C(o, t, a)), r(p);
|
|
394
482
|
}
|
|
395
483
|
return !0;
|
|
396
484
|
};
|
|
397
485
|
}
|
|
398
|
-
function
|
|
486
|
+
function jt(o, t) {
|
|
399
487
|
return (e, n) => {
|
|
400
488
|
const r = t ?? e.doc.body.rows.length;
|
|
401
489
|
if (n) {
|
|
@@ -409,15 +497,15 @@ function Ct(o, t) {
|
|
|
409
497
|
l.body.rows.splice(r, 1);
|
|
410
498
|
}
|
|
411
499
|
);
|
|
412
|
-
s.addStep(i), s.setSelection(
|
|
500
|
+
s.addStep(i), s.setSelection(R(o.id)), n(s);
|
|
413
501
|
}
|
|
414
502
|
return !0;
|
|
415
503
|
};
|
|
416
504
|
}
|
|
417
|
-
function
|
|
505
|
+
function zt(o) {
|
|
418
506
|
return (t, e) => {
|
|
419
507
|
const n = t.doc.body.rows.findIndex((r) => r.id === o);
|
|
420
|
-
if (n === -1) return !1;
|
|
508
|
+
if (n === -1 || t.doc.body.rows[n].locked) return !1;
|
|
421
509
|
if (e) {
|
|
422
510
|
const r = structuredClone(t.doc.body.rows[n]), s = t.createTransaction(), i = m(
|
|
423
511
|
"deleteRow",
|
|
@@ -434,10 +522,10 @@ function _t(o) {
|
|
|
434
522
|
return !0;
|
|
435
523
|
};
|
|
436
524
|
}
|
|
437
|
-
function
|
|
525
|
+
function Nt(o, t) {
|
|
438
526
|
return (e, n) => {
|
|
439
527
|
const r = e.doc.body.rows.findIndex((s) => s.id === o);
|
|
440
|
-
if (r === -1 || r === t) return !1;
|
|
528
|
+
if (r === -1 || e.doc.body.rows[r].locked || r === t) return !1;
|
|
441
529
|
if (n) {
|
|
442
530
|
const s = e.createTransaction(), i = m(
|
|
443
531
|
"moveRow",
|
|
@@ -451,15 +539,15 @@ function Rt(o, t) {
|
|
|
451
539
|
l.body.rows.splice(r, 0, c);
|
|
452
540
|
}
|
|
453
541
|
);
|
|
454
|
-
s.addStep(i), s.setSelection(
|
|
542
|
+
s.addStep(i), s.setSelection(R(o)), n(s);
|
|
455
543
|
}
|
|
456
544
|
return !0;
|
|
457
545
|
};
|
|
458
546
|
}
|
|
459
|
-
function
|
|
547
|
+
function qt(o) {
|
|
460
548
|
return (t, e) => {
|
|
461
549
|
const n = t.doc.body.rows.findIndex((r) => r.id === o);
|
|
462
|
-
if (n === -1) return !1;
|
|
550
|
+
if (n === -1 || t.doc.body.rows[n].locked) return !1;
|
|
463
551
|
if (e) {
|
|
464
552
|
const r = t.doc.body.rows[n], s = structuredClone(r);
|
|
465
553
|
s.id = g(), s.columns.forEach((a) => {
|
|
@@ -477,15 +565,15 @@ function Tt(o) {
|
|
|
477
565
|
a.body.rows.splice(i, 1);
|
|
478
566
|
}
|
|
479
567
|
);
|
|
480
|
-
l.addStep(c), l.setSelection(
|
|
568
|
+
l.addStep(c), l.setSelection(R(s.id)), e(l);
|
|
481
569
|
}
|
|
482
570
|
return !0;
|
|
483
571
|
};
|
|
484
572
|
}
|
|
485
|
-
function
|
|
573
|
+
function Ut(o, t) {
|
|
486
574
|
return (e, n) => {
|
|
487
575
|
const r = e.doc.body.rows.findIndex((s) => s.id === o);
|
|
488
|
-
if (r === -1) return !1;
|
|
576
|
+
if (r === -1 || e.doc.body.rows[r].locked) return !1;
|
|
489
577
|
if (n) {
|
|
490
578
|
const s = { ...e.doc.body.rows[r].attributes }, i = e.createTransaction(), l = m(
|
|
491
579
|
"updateRowAttributes",
|
|
@@ -502,14 +590,14 @@ function $t(o, t) {
|
|
|
502
590
|
return !0;
|
|
503
591
|
};
|
|
504
592
|
}
|
|
505
|
-
function
|
|
593
|
+
function Ft(o) {
|
|
506
594
|
return (t, e) => {
|
|
507
595
|
const n = t.doc.body.rows.findIndex((s) => s.id === o);
|
|
508
596
|
if (n === -1) return !1;
|
|
509
597
|
const r = t.doc.body.rows[n];
|
|
510
598
|
if (r.locked || r.columns.length >= 4) return !1;
|
|
511
599
|
if (e) {
|
|
512
|
-
const s =
|
|
600
|
+
const s = M(), i = r.columns.length + 1, l = L(i), c = [...r.columnRatios], a = t.createTransaction(), u = m(
|
|
513
601
|
"addColumn",
|
|
514
602
|
`body.rows[${n}]`,
|
|
515
603
|
(d) => {
|
|
@@ -524,7 +612,7 @@ function Bt(o) {
|
|
|
524
612
|
return !0;
|
|
525
613
|
};
|
|
526
614
|
}
|
|
527
|
-
function
|
|
615
|
+
function Gt(o, t) {
|
|
528
616
|
return (e, n) => {
|
|
529
617
|
const r = e.doc.body.rows.findIndex((l) => l.id === o);
|
|
530
618
|
if (r === -1) return !1;
|
|
@@ -533,7 +621,7 @@ function Mt(o, t) {
|
|
|
533
621
|
const i = s.columns.findIndex((l) => l.id === t);
|
|
534
622
|
if (i === -1) return !1;
|
|
535
623
|
if (n) {
|
|
536
|
-
const l = structuredClone(s.columns[i]), c = [...s.columnRatios], a = s.columns.length - 1, u =
|
|
624
|
+
const l = structuredClone(s.columns[i]), c = [...s.columnRatios], a = s.columns.length - 1, u = L(a), d = e.createTransaction(), p = m(
|
|
537
625
|
"removeColumn",
|
|
538
626
|
`body.rows[${r}]`,
|
|
539
627
|
(b) => {
|
|
@@ -548,12 +636,12 @@ function Mt(o, t) {
|
|
|
548
636
|
return !0;
|
|
549
637
|
};
|
|
550
638
|
}
|
|
551
|
-
function
|
|
639
|
+
function Kt(o, t) {
|
|
552
640
|
return (e, n) => {
|
|
553
641
|
const r = e.doc.body.rows.findIndex((l) => l.id === o);
|
|
554
642
|
if (r === -1) return !1;
|
|
555
643
|
const s = e.doc.body.rows[r];
|
|
556
|
-
if (t.length !== s.columns.length || t.reduce((l, c) => l + c, 0) !== 12) return !1;
|
|
644
|
+
if (s.locked || t.length !== s.columns.length || t.reduce((l, c) => l + c, 0) !== 12) return !1;
|
|
557
645
|
if (n) {
|
|
558
646
|
const l = [...s.columnRatios], c = e.createTransaction(), a = m(
|
|
559
647
|
"resizeColumns",
|
|
@@ -570,14 +658,38 @@ function Wt(o, t) {
|
|
|
570
658
|
return !0;
|
|
571
659
|
};
|
|
572
660
|
}
|
|
573
|
-
function
|
|
661
|
+
function Yt(o, t, e) {
|
|
662
|
+
return (n, r) => {
|
|
663
|
+
const s = n.doc.body.rows.findIndex((c) => c.id === o);
|
|
664
|
+
if (s === -1) return !1;
|
|
665
|
+
const i = n.doc.body.rows[s];
|
|
666
|
+
if (i.locked) return !1;
|
|
667
|
+
const l = i.columns.findIndex((c) => c.id === t);
|
|
668
|
+
if (l === -1) return !1;
|
|
669
|
+
if (r) {
|
|
670
|
+
const c = { ...i.columns[l].attributes }, a = n.createTransaction(), u = m(
|
|
671
|
+
"updateColumnAttributes",
|
|
672
|
+
`body.rows[${s}].columns[${l}].attributes`,
|
|
673
|
+
(d) => {
|
|
674
|
+
Object.assign(d.body.rows[s].columns[l].attributes, e);
|
|
675
|
+
},
|
|
676
|
+
(d) => {
|
|
677
|
+
d.body.rows[s].columns[l].attributes = c;
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
a.addStep(u), r(a);
|
|
681
|
+
}
|
|
682
|
+
return !0;
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function L(o) {
|
|
574
686
|
const t = Math.floor(12 / o), e = 12 - t * o, n = new Array(o).fill(t);
|
|
575
687
|
for (let r = 0; r < e; r++)
|
|
576
688
|
n[r] += 1;
|
|
577
689
|
return n;
|
|
578
690
|
}
|
|
579
|
-
const
|
|
580
|
-
function
|
|
691
|
+
const ot = ["text", "image", "button", "divider", "spacer", "social", "html", "hero", "navbar"];
|
|
692
|
+
function nt(o) {
|
|
581
693
|
const t = [];
|
|
582
694
|
if (!o || typeof o != "object")
|
|
583
695
|
return t.push({ path: "", message: "Document must be an object" }), t;
|
|
@@ -586,124 +698,75 @@ function Y(o) {
|
|
|
586
698
|
return t.push({ path: "body", message: "Body is required" }), t;
|
|
587
699
|
const n = e.body;
|
|
588
700
|
return (!n.attributes || typeof n.attributes != "object") && t.push({ path: "body.attributes", message: "Body attributes are required" }), Array.isArray(n.rows) ? (n.rows.forEach((r, s) => {
|
|
589
|
-
t.push(...
|
|
701
|
+
t.push(...rt(r, `body.rows[${s}]`));
|
|
590
702
|
}), t) : (t.push({ path: "body.rows", message: "Rows must be an array" }), t);
|
|
591
703
|
}
|
|
592
|
-
function
|
|
704
|
+
function rt(o, t) {
|
|
593
705
|
const e = [];
|
|
594
706
|
return o.id || e.push({ path: `${t}.id`, message: "Row must have an id" }), o.type !== "row" && e.push({ path: `${t}.type`, message: 'Row type must be "row"' }), Array.isArray(o.columns) ? (Array.isArray(o.columnRatios) ? o.columnRatios.length !== o.columns.length && e.push({
|
|
595
707
|
path: `${t}.columnRatios`,
|
|
596
708
|
message: "Column ratios length must match columns length"
|
|
597
709
|
}) : e.push({ path: `${t}.columnRatios`, message: "Column ratios must be an array" }), o.columns.forEach((n, r) => {
|
|
598
|
-
e.push(...
|
|
710
|
+
e.push(...st(n, `${t}.columns[${r}]`));
|
|
599
711
|
}), e) : (e.push({ path: `${t}.columns`, message: "Columns must be an array" }), e);
|
|
600
712
|
}
|
|
601
|
-
function
|
|
713
|
+
function st(o, t) {
|
|
602
714
|
const e = [];
|
|
603
715
|
return o.id || e.push({ path: `${t}.id`, message: "Column must have an id" }), Array.isArray(o.blocks) ? (o.blocks.forEach((n, r) => {
|
|
604
|
-
e.push(...
|
|
716
|
+
e.push(...it(n, `${t}.blocks[${r}]`));
|
|
605
717
|
}), e) : (e.push({ path: `${t}.blocks`, message: "Blocks must be an array" }), e);
|
|
606
718
|
}
|
|
607
|
-
function
|
|
719
|
+
function it(o, t) {
|
|
608
720
|
const e = [];
|
|
609
|
-
return o.id || e.push({ path: `${t}.id`, message: "Block must have an id" }),
|
|
610
|
-
}
|
|
611
|
-
function
|
|
612
|
-
return
|
|
613
|
-
}
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
label: "Spacer",
|
|
642
|
-
icon: "spacer",
|
|
643
|
-
defaultValues: w("spacer")
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
type: "social",
|
|
647
|
-
label: "Social",
|
|
648
|
-
icon: "social",
|
|
649
|
-
defaultValues: w("social")
|
|
650
|
-
},
|
|
651
|
-
{
|
|
652
|
-
type: "html",
|
|
653
|
-
label: "HTML",
|
|
654
|
-
icon: "html",
|
|
655
|
-
defaultValues: w("html")
|
|
656
|
-
},
|
|
657
|
-
{
|
|
658
|
-
type: "hero",
|
|
659
|
-
label: "Hero",
|
|
660
|
-
icon: "hero",
|
|
661
|
-
defaultValues: w("hero")
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
type: "navbar",
|
|
665
|
-
label: "Navbar",
|
|
666
|
-
icon: "navbar",
|
|
667
|
-
defaultValues: w("navbar")
|
|
668
|
-
}
|
|
669
|
-
];
|
|
670
|
-
function Q() {
|
|
671
|
-
for (const o of J)
|
|
672
|
-
x.set(o.type, o);
|
|
673
|
-
U((o) => {
|
|
674
|
-
var t;
|
|
675
|
-
return (t = x.get(o)) == null ? void 0 : t.defaultValues;
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
function tt(o) {
|
|
679
|
-
x.set(o.type, o);
|
|
680
|
-
}
|
|
681
|
-
function Et(o) {
|
|
682
|
-
return x.get(o);
|
|
683
|
-
}
|
|
684
|
-
function Vt() {
|
|
685
|
-
return Array.from(x.values());
|
|
686
|
-
}
|
|
687
|
-
function Pt(o) {
|
|
688
|
-
return x.has(o);
|
|
721
|
+
return o.id || e.push({ path: `${t}.id`, message: "Block must have an id" }), ot.includes(o.type) || e.push({ path: `${t}.type`, message: `Invalid block type: ${o.type}` }), (!o.values || typeof o.values != "object") && e.push({ path: `${t}.values`, message: "Block must have values" }), e;
|
|
722
|
+
}
|
|
723
|
+
function Xt(o) {
|
|
724
|
+
return nt(o).length === 0;
|
|
725
|
+
}
|
|
726
|
+
const lt = "/* pigeon-generated:";
|
|
727
|
+
function ct(o) {
|
|
728
|
+
return `${lt} ${o} */`;
|
|
729
|
+
}
|
|
730
|
+
function at(o) {
|
|
731
|
+
var t;
|
|
732
|
+
return (t = /^\s*\/\*\s*pigeon-generated:\s*([\w-]+)\s*\*\//.exec(o)) == null ? void 0 : t[1];
|
|
733
|
+
}
|
|
734
|
+
const W = "link-style", H = "a, a:visited";
|
|
735
|
+
function Zt(o) {
|
|
736
|
+
const t = [
|
|
737
|
+
o.color !== void 0 && `color: ${o.color};`,
|
|
738
|
+
o.underline !== void 0 && `text-decoration: ${o.underline ? "underline" : "none"};`
|
|
739
|
+
].filter(Boolean);
|
|
740
|
+
if (t.length)
|
|
741
|
+
return `${ct(W)}
|
|
742
|
+
${H} { ${t.join(" ")} }
|
|
743
|
+
a[x-apple-data-detectors] { color: inherit !important; text-decoration: inherit !important; }`;
|
|
744
|
+
}
|
|
745
|
+
function Jt(o) {
|
|
746
|
+
var s, i, l;
|
|
747
|
+
if (at(o) !== W) return;
|
|
748
|
+
const t = ((s = new RegExp(`${H}\\s*\\{([^}]*)\\}`).exec(o)) == null ? void 0 : s[1]) ?? "", e = (i = /(?:^|;|\s)color:\s*([^;]+)/.exec(t)) == null ? void 0 : i[1].trim(), n = (l = /text-decoration:\s*([^;]+)/.exec(t)) == null ? void 0 : l[1].trim(), r = {
|
|
749
|
+
...e !== void 0 ? { color: e } : {},
|
|
750
|
+
...n !== void 0 ? { underline: n === "underline" } : {}
|
|
751
|
+
};
|
|
752
|
+
return Object.keys(r).length ? r : void 0;
|
|
689
753
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
function ot() {
|
|
754
|
+
const dt = 100;
|
|
755
|
+
function ut() {
|
|
693
756
|
return {
|
|
694
757
|
undoStack: [],
|
|
695
758
|
redoStack: []
|
|
696
759
|
};
|
|
697
760
|
}
|
|
698
|
-
function
|
|
761
|
+
function ft(o, t) {
|
|
699
762
|
const e = [...o.undoStack, t];
|
|
700
|
-
return e.length >
|
|
763
|
+
return e.length > dt && e.shift(), {
|
|
701
764
|
undoStack: e,
|
|
702
765
|
redoStack: []
|
|
703
766
|
// Clear redo stack on new change
|
|
704
767
|
};
|
|
705
768
|
}
|
|
706
|
-
function
|
|
769
|
+
function pt(o) {
|
|
707
770
|
if (o.undoStack.length === 0)
|
|
708
771
|
return { history: o, entry: null };
|
|
709
772
|
const t = [...o.undoStack], e = t.pop(), n = [...o.redoStack, e];
|
|
@@ -712,7 +775,7 @@ function rt(o) {
|
|
|
712
775
|
entry: e
|
|
713
776
|
};
|
|
714
777
|
}
|
|
715
|
-
function
|
|
778
|
+
function mt(o) {
|
|
716
779
|
if (o.redoStack.length === 0)
|
|
717
780
|
return { history: o, entry: null };
|
|
718
781
|
const t = [...o.redoStack], e = t.pop();
|
|
@@ -721,18 +784,18 @@ function st(o) {
|
|
|
721
784
|
entry: e
|
|
722
785
|
};
|
|
723
786
|
}
|
|
724
|
-
function
|
|
787
|
+
function bt(o) {
|
|
725
788
|
return o.undoStack.length > 0;
|
|
726
789
|
}
|
|
727
|
-
function
|
|
790
|
+
function gt(o) {
|
|
728
791
|
return o.redoStack.length > 0;
|
|
729
792
|
}
|
|
730
|
-
const
|
|
731
|
-
function
|
|
793
|
+
const T = "history";
|
|
794
|
+
function Qt() {
|
|
732
795
|
return {
|
|
733
|
-
name:
|
|
796
|
+
name: T,
|
|
734
797
|
init() {
|
|
735
|
-
return
|
|
798
|
+
return ut();
|
|
736
799
|
},
|
|
737
800
|
apply(o, t) {
|
|
738
801
|
const e = t;
|
|
@@ -745,15 +808,15 @@ function Dt() {
|
|
|
745
808
|
doc: o.doc,
|
|
746
809
|
timestamp: Date.now()
|
|
747
810
|
};
|
|
748
|
-
return
|
|
811
|
+
return ft(e, n);
|
|
749
812
|
}
|
|
750
813
|
};
|
|
751
814
|
}
|
|
752
|
-
function
|
|
753
|
-
const e = o.plugins.get(
|
|
754
|
-
if (!e || !
|
|
815
|
+
function te(o, t) {
|
|
816
|
+
const e = o.plugins.get(T);
|
|
817
|
+
if (!e || !bt(e)) return !1;
|
|
755
818
|
if (t) {
|
|
756
|
-
const { history: n, entry: r } =
|
|
819
|
+
const { history: n, entry: r } = pt(e);
|
|
757
820
|
if (!r) return !1;
|
|
758
821
|
const s = o.createTransaction();
|
|
759
822
|
for (let i = r.steps.length - 1; i >= 0; i--) {
|
|
@@ -764,11 +827,11 @@ function Lt(o, t) {
|
|
|
764
827
|
}
|
|
765
828
|
return !0;
|
|
766
829
|
}
|
|
767
|
-
function
|
|
768
|
-
const e = o.plugins.get(
|
|
769
|
-
if (!e || !
|
|
830
|
+
function ee(o, t) {
|
|
831
|
+
const e = o.plugins.get(T);
|
|
832
|
+
if (!e || !gt(e)) return !1;
|
|
770
833
|
if (t) {
|
|
771
|
-
const { history: n, entry: r } =
|
|
834
|
+
const { history: n, entry: r } = mt(e);
|
|
772
835
|
if (!r) return !1;
|
|
773
836
|
const s = o.createTransaction();
|
|
774
837
|
for (const i of r.steps)
|
|
@@ -777,7 +840,7 @@ function Ot(o, t) {
|
|
|
777
840
|
}
|
|
778
841
|
return !0;
|
|
779
842
|
}
|
|
780
|
-
class
|
|
843
|
+
class oe {
|
|
781
844
|
constructor() {
|
|
782
845
|
this._plugins = /* @__PURE__ */ new Map();
|
|
783
846
|
}
|
|
@@ -786,7 +849,7 @@ class jt {
|
|
|
786
849
|
throw new Error(`Plugin "${t.name}" is already registered`);
|
|
787
850
|
if (this._plugins.set(t.name, t), t.blocks)
|
|
788
851
|
for (const e of t.blocks)
|
|
789
|
-
|
|
852
|
+
Q(e);
|
|
790
853
|
}
|
|
791
854
|
unregister(t) {
|
|
792
855
|
this._plugins.delete(t);
|
|
@@ -807,15 +870,15 @@ class jt {
|
|
|
807
870
|
return this._plugins.has(t);
|
|
808
871
|
}
|
|
809
872
|
}
|
|
810
|
-
function
|
|
873
|
+
function $(o, t) {
|
|
811
874
|
if (o === t) return !0;
|
|
812
875
|
if (o == null || t == null || typeof o != typeof t) return !1;
|
|
813
876
|
if (Array.isArray(o))
|
|
814
|
-
return !Array.isArray(t) || o.length !== t.length ? !1 : o.every((e, n) =>
|
|
877
|
+
return !Array.isArray(t) || o.length !== t.length ? !1 : o.every((e, n) => $(e, t[n]));
|
|
815
878
|
if (typeof o == "object") {
|
|
816
879
|
const e = Object.keys(o), n = Object.keys(t);
|
|
817
880
|
return e.length !== n.length ? !1 : e.every(
|
|
818
|
-
(r) =>
|
|
881
|
+
(r) => $(
|
|
819
882
|
o[r],
|
|
820
883
|
t[r]
|
|
821
884
|
)
|
|
@@ -823,7 +886,28 @@ function R(o, t) {
|
|
|
823
886
|
}
|
|
824
887
|
return !1;
|
|
825
888
|
}
|
|
826
|
-
const
|
|
889
|
+
const ht = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "ps", "sd", "dv", "yi"]);
|
|
890
|
+
function ne(o, t) {
|
|
891
|
+
if (t) return t;
|
|
892
|
+
const e = (o || "en").toLowerCase().split(/[-_]/)[0];
|
|
893
|
+
return ht.has(e) ? "rtl" : "ltr";
|
|
894
|
+
}
|
|
895
|
+
const A = {
|
|
896
|
+
repeat: "no-repeat",
|
|
897
|
+
size: "cover",
|
|
898
|
+
position: "top center"
|
|
899
|
+
};
|
|
900
|
+
function re(o) {
|
|
901
|
+
const t = o.attributes;
|
|
902
|
+
if (t.backgroundImage)
|
|
903
|
+
return {
|
|
904
|
+
url: t.backgroundImage,
|
|
905
|
+
repeat: t.backgroundRepeat ?? A.repeat,
|
|
906
|
+
size: t.backgroundSize ?? A.size,
|
|
907
|
+
position: t.backgroundPosition ?? A.position
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
const f = "2026-05-26T10:00:00.000Z", yt = {
|
|
827
911
|
id: "starter-welcome",
|
|
828
912
|
name: "Welcome",
|
|
829
913
|
description: "A clean welcome email with a hero, intro paragraph, and call-to-action.",
|
|
@@ -923,7 +1007,7 @@ const f = "2026-05-26T10:00:00.000Z", ct = {
|
|
|
923
1007
|
]
|
|
924
1008
|
}
|
|
925
1009
|
}
|
|
926
|
-
},
|
|
1010
|
+
}, wt = {
|
|
927
1011
|
id: "starter-newsletter",
|
|
928
1012
|
name: "Newsletter",
|
|
929
1013
|
description: "A simple 3-section newsletter — headline + body + footer.",
|
|
@@ -1005,7 +1089,7 @@ const f = "2026-05-26T10:00:00.000Z", ct = {
|
|
|
1005
1089
|
]
|
|
1006
1090
|
}
|
|
1007
1091
|
}
|
|
1008
|
-
},
|
|
1092
|
+
}, kt = {
|
|
1009
1093
|
id: "starter-transactional",
|
|
1010
1094
|
name: "Transactional (order confirmation)",
|
|
1011
1095
|
description: "Order confirmation pattern with summary and a primary button.",
|
|
@@ -1094,7 +1178,7 @@ const f = "2026-05-26T10:00:00.000Z", ct = {
|
|
|
1094
1178
|
]
|
|
1095
1179
|
}
|
|
1096
1180
|
}
|
|
1097
|
-
},
|
|
1181
|
+
}, xt = {
|
|
1098
1182
|
id: "starter-promo",
|
|
1099
1183
|
name: "Promo / Sale",
|
|
1100
1184
|
description: "Two-column product grid with a primary CTA and a social-link footer.",
|
|
@@ -1236,38 +1320,50 @@ const f = "2026-05-26T10:00:00.000Z", ct = {
|
|
|
1236
1320
|
]
|
|
1237
1321
|
}
|
|
1238
1322
|
}
|
|
1239
|
-
},
|
|
1240
|
-
function
|
|
1241
|
-
return
|
|
1323
|
+
}, P = Object.freeze([yt, wt, kt, xt]);
|
|
1324
|
+
function It() {
|
|
1325
|
+
return P.map((o) => structuredClone(o));
|
|
1242
1326
|
}
|
|
1243
|
-
function
|
|
1244
|
-
const t =
|
|
1327
|
+
function se(o) {
|
|
1328
|
+
const t = P.find((e) => e.id === o);
|
|
1245
1329
|
return t ? structuredClone(t) : null;
|
|
1246
1330
|
}
|
|
1247
|
-
|
|
1331
|
+
async function vt() {
|
|
1332
|
+
const { GALLERY_TEMPLATES: o } = await import("./gallery.js");
|
|
1333
|
+
return o.map((t) => structuredClone(t));
|
|
1334
|
+
}
|
|
1335
|
+
class ie {
|
|
1248
1336
|
constructor(t = {}) {
|
|
1249
|
-
if (this._byId = /* @__PURE__ */ new Map(), t.includeStarters !== !1)
|
|
1250
|
-
for (const e of
|
|
1337
|
+
if (this._byId = /* @__PURE__ */ new Map(), this._includeGallery = t.includeStarters !== !1, this._includeGallery)
|
|
1338
|
+
for (const e of It()) this._byId.set(e.id, e);
|
|
1251
1339
|
if (t.seed)
|
|
1252
1340
|
for (const e of t.seed) this._byId.set(e.id, e);
|
|
1253
1341
|
}
|
|
1254
1342
|
async list() {
|
|
1255
|
-
return Array.from(this._byId.values()).map((t) => structuredClone(t));
|
|
1343
|
+
return await this._ready(), Array.from(this._byId.values()).map((t) => structuredClone(t));
|
|
1256
1344
|
}
|
|
1257
1345
|
async get(t) {
|
|
1346
|
+
await this._ready();
|
|
1258
1347
|
const e = this._byId.get(t);
|
|
1259
1348
|
return e ? structuredClone(e) : null;
|
|
1260
1349
|
}
|
|
1261
1350
|
async save(t) {
|
|
1262
1351
|
if (!t.id) throw new Error("Template.id is required");
|
|
1352
|
+
await this._ready();
|
|
1263
1353
|
const e = structuredClone(t);
|
|
1264
1354
|
e.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), this._byId.has(e.id) || (e.createdAt = e.updatedAt), this._byId.set(e.id, e);
|
|
1265
1355
|
}
|
|
1266
1356
|
async delete(t) {
|
|
1267
|
-
this._byId.delete(t);
|
|
1357
|
+
await this._ready(), this._byId.delete(t);
|
|
1358
|
+
}
|
|
1359
|
+
/** Merges the gallery once; seeded or saved templates with the same id win. */
|
|
1360
|
+
_ready() {
|
|
1361
|
+
return this._includeGallery ? (this._gallery ?? (this._gallery = vt().then((t) => {
|
|
1362
|
+
for (const e of t) this._byId.has(e.id) || this._byId.set(e.id, e);
|
|
1363
|
+
})), this._gallery) : Promise.resolve();
|
|
1268
1364
|
}
|
|
1269
1365
|
}
|
|
1270
|
-
class
|
|
1366
|
+
class le {
|
|
1271
1367
|
constructor(t = {}) {
|
|
1272
1368
|
if (this._byId = /* @__PURE__ */ new Map(), t.seed)
|
|
1273
1369
|
for (const e of t.seed) this._byId.set(e.id, e);
|
|
@@ -1288,13 +1384,13 @@ class qt {
|
|
|
1288
1384
|
this._byId.delete(t);
|
|
1289
1385
|
}
|
|
1290
1386
|
}
|
|
1291
|
-
class
|
|
1387
|
+
class ce {
|
|
1292
1388
|
constructor(t = {}) {
|
|
1293
1389
|
if (this._byId = /* @__PURE__ */ new Map(), t.seed)
|
|
1294
1390
|
for (const e of t.seed) this._byId.set(e.id, e);
|
|
1295
1391
|
}
|
|
1296
1392
|
async list(t = {}) {
|
|
1297
|
-
let n = Array.from(this._byId.values()).map((i) => structuredClone(i)).filter((i) =>
|
|
1393
|
+
let n = Array.from(this._byId.values()).map((i) => structuredClone(i)).filter((i) => St(i, t));
|
|
1298
1394
|
n.sort((i, l) => i.updatedAt < l.updatedAt ? 1 : i.updatedAt > l.updatedAt ? -1 : 0);
|
|
1299
1395
|
const r = t.offset ?? 0, s = t.limit;
|
|
1300
1396
|
return n = n.slice(r, s !== void 0 ? r + s : void 0), n;
|
|
@@ -1318,7 +1414,7 @@ class Ut {
|
|
|
1318
1414
|
return Array.from(t).sort();
|
|
1319
1415
|
}
|
|
1320
1416
|
}
|
|
1321
|
-
function
|
|
1417
|
+
function St(o, t) {
|
|
1322
1418
|
if (t.folder && (o.folder || "/") !== t.folder)
|
|
1323
1419
|
return !1;
|
|
1324
1420
|
if (t.tags && t.tags.length > 0) {
|
|
@@ -1331,7 +1427,7 @@ function pt(o, t) {
|
|
|
1331
1427
|
}
|
|
1332
1428
|
return !0;
|
|
1333
1429
|
}
|
|
1334
|
-
class
|
|
1430
|
+
class ae {
|
|
1335
1431
|
constructor(t = {}) {
|
|
1336
1432
|
if (this._byId = /* @__PURE__ */ new Map(), t.seed)
|
|
1337
1433
|
for (const e of t.seed) this._byId.set(e.id, e);
|
|
@@ -1352,7 +1448,7 @@ class Ft {
|
|
|
1352
1448
|
this._byId.delete(t);
|
|
1353
1449
|
}
|
|
1354
1450
|
}
|
|
1355
|
-
function
|
|
1451
|
+
function de(o) {
|
|
1356
1452
|
const t = structuredClone(o);
|
|
1357
1453
|
return t.id = g(), t.columns.forEach((e) => {
|
|
1358
1454
|
e.id = g(), e.blocks.forEach((n) => {
|
|
@@ -1360,61 +1456,73 @@ function Kt(o) {
|
|
|
1360
1456
|
});
|
|
1361
1457
|
}), t;
|
|
1362
1458
|
}
|
|
1363
|
-
const
|
|
1459
|
+
const ue = [
|
|
1364
1460
|
{ id: "unsubscribe", label: "Unsubscribe", href: "{{unsubscribe_url}}" },
|
|
1365
1461
|
{ id: "view-in-browser", label: "View in browser", href: "{{view_in_browser_url}}" },
|
|
1366
1462
|
{ id: "email", label: "Email address", prompt: "email" },
|
|
1367
1463
|
{ id: "phone", label: "Phone number", prompt: "tel" }
|
|
1368
1464
|
];
|
|
1369
1465
|
export {
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1466
|
+
_ as EditorState,
|
|
1467
|
+
T as HISTORY_PLUGIN_NAME,
|
|
1468
|
+
ce as InMemoryAssetStorage,
|
|
1469
|
+
le as InMemoryBrandKitStorage,
|
|
1470
|
+
ae as InMemoryRowLibraryStorage,
|
|
1471
|
+
ie as InMemoryTemplateStorage,
|
|
1472
|
+
W as LINK_STYLE_NAME,
|
|
1473
|
+
oe as PluginRegistry,
|
|
1474
|
+
ue as SYSTEM_LINK_TYPES,
|
|
1475
|
+
D as Transaction,
|
|
1476
|
+
Ft as addColumn,
|
|
1477
|
+
gt as canRedo,
|
|
1478
|
+
bt as canUndo,
|
|
1479
|
+
de as cloneRowWithNewIds,
|
|
1480
|
+
Ct as createBlock,
|
|
1481
|
+
C as createBlockSelection,
|
|
1482
|
+
$t as createBodySelection,
|
|
1483
|
+
M as createColumn,
|
|
1484
|
+
Tt as createColumnSelection,
|
|
1485
|
+
X as createDefaultDocument,
|
|
1389
1486
|
m as createDocStep,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1487
|
+
Qt as createHistoryPlugin,
|
|
1488
|
+
Rt as createRow,
|
|
1489
|
+
R as createRowSelection,
|
|
1490
|
+
Jt as cssToLinkStyle,
|
|
1491
|
+
$ as deepEqual,
|
|
1394
1492
|
h as defaultSpacing,
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1493
|
+
Pt as deleteBlock,
|
|
1494
|
+
zt as deleteRow,
|
|
1495
|
+
Ot as duplicateBlock,
|
|
1496
|
+
qt as duplicateRow,
|
|
1399
1497
|
g as generateId,
|
|
1400
|
-
|
|
1498
|
+
ct as generatedStyleMarker,
|
|
1499
|
+
at as generatedStyleName,
|
|
1500
|
+
tt as getAllBlockDefinitions,
|
|
1501
|
+
Lt as getAvailableBlockDefinitions,
|
|
1401
1502
|
Et as getBlockDefinition,
|
|
1402
1503
|
w as getDefaultValues,
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1504
|
+
se as getStarterTemplate,
|
|
1505
|
+
It as getStarterTemplates,
|
|
1506
|
+
Ht as insertBlock,
|
|
1507
|
+
jt as insertRow,
|
|
1508
|
+
et as isBlockTypeAvailable,
|
|
1509
|
+
Wt as isKnownBlockType,
|
|
1510
|
+
Xt as isValidDocument,
|
|
1511
|
+
Zt as linkStyleToCss,
|
|
1512
|
+
vt as loadGalleryTemplates,
|
|
1513
|
+
Dt as moveBlock,
|
|
1514
|
+
Nt as moveRow,
|
|
1515
|
+
ee as redo,
|
|
1516
|
+
Q as registerBlock,
|
|
1517
|
+
Gt as removeColumn,
|
|
1518
|
+
Kt as resizeColumns,
|
|
1519
|
+
ne as resolveDirection,
|
|
1520
|
+
re as resolveRowBackground,
|
|
1521
|
+
Bt as selectionsEqual,
|
|
1522
|
+
Mt as setAvailableBlockTypes,
|
|
1523
|
+
te as undo,
|
|
1524
|
+
Vt as updateBlock,
|
|
1525
|
+
Yt as updateColumnAttributes,
|
|
1526
|
+
Ut as updateRowAttributes,
|
|
1527
|
+
nt as validateDocument
|
|
1420
1528
|
};
|