bootstrap-email-wysiwyg 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +374 -0
- package/dist/bootstrap-email-wysiwyg.cjs +18 -0
- package/dist/bootstrap-email-wysiwyg.css +1 -0
- package/dist/bootstrap-email-wysiwyg.js +1957 -0
- package/dist/index.d.ts +483 -0
- package/package.json +73 -0
|
@@ -0,0 +1,1957 @@
|
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var It = (e, n, t) => n in e ? At(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var p = (e, n, t) => It(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { jsxs as b, jsx as i, Fragment as Mt } from "react/jsx-runtime";
|
|
5
|
+
import { useState as C, useEffect as L, useRef as V, useCallback as _, forwardRef as Bt, useImperativeHandle as Dt } from "react";
|
|
6
|
+
import { LexicalComposer as Wt } from "@lexical/react/LexicalComposer";
|
|
7
|
+
import { RichTextPlugin as zt } from "@lexical/react/LexicalRichTextPlugin";
|
|
8
|
+
import { ContentEditable as Ht } from "@lexical/react/LexicalContentEditable";
|
|
9
|
+
import { HistoryPlugin as Ft } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
|
+
import { LexicalErrorBoundary as Rt } from "@lexical/react/LexicalErrorBoundary";
|
|
11
|
+
import { useLexicalComposerContext as E } from "@lexical/react/LexicalComposerContext";
|
|
12
|
+
import { $applyNodeReplacement as X, $createTextNode as jt, ElementNode as Kt, ParagraphNode as ct, $getNodeByKey as ut, DecoratorNode as ht, $getSelection as D, $isRangeSelection as W, $insertNodes as Pt, $isElementNode as Jt, SELECTION_CHANGE_COMMAND as Ut, COMMAND_PRIORITY_LOW as H, CAN_UNDO_COMMAND as Gt, CAN_REDO_COMMAND as Vt, FORMAT_TEXT_COMMAND as Xt, FORMAT_ELEMENT_COMMAND as Yt, UNDO_COMMAND as Zt, REDO_COMMAND as qt, $getRoot as Qt } from "lexical";
|
|
13
|
+
import { $insertNodeToNearestRoot as dt, mergeRegister as te } from "@lexical/utils";
|
|
14
|
+
import { $patchStyleText as ft, $getSelectionStyleValueForProperty as ee } from "@lexical/selection";
|
|
15
|
+
import { $generateHtmlFromNodes as re } from "@lexical/html";
|
|
16
|
+
const ne = {
|
|
17
|
+
paragraph: "bew-paragraph",
|
|
18
|
+
text: {
|
|
19
|
+
bold: "bew-text-bold",
|
|
20
|
+
italic: "bew-text-italic",
|
|
21
|
+
underline: "bew-text-underline",
|
|
22
|
+
strikethrough: "bew-text-strikethrough"
|
|
23
|
+
}
|
|
24
|
+
}, Y = [
|
|
25
|
+
{ token: "primary", hex: "#0d6efd" },
|
|
26
|
+
{ token: "secondary", hex: "#6c757d" },
|
|
27
|
+
{ token: "success", hex: "#198754" },
|
|
28
|
+
{ token: "info", hex: "#0dcaf0" },
|
|
29
|
+
{ token: "warning", hex: "#ffc107" },
|
|
30
|
+
{ token: "danger", hex: "#dc3545" },
|
|
31
|
+
{ token: "light", hex: "#f8f9fa" },
|
|
32
|
+
{ token: "dark", hex: "#212529" },
|
|
33
|
+
{ token: "black", hex: "#000000" },
|
|
34
|
+
{ token: "white", hex: "#ffffff" },
|
|
35
|
+
{ token: "transparent", hex: "transparent" }
|
|
36
|
+
], oe = {
|
|
37
|
+
gray: ["#f8f9fa", "#e9ecef", "#dee2e6", "#ced4da", "#adb5bd", "#6c757d", "#495057", "#343a40", "#212529"],
|
|
38
|
+
blue: ["#cfe2ff", "#9ec5fe", "#6ea8fe", "#3d8bfd", "#0d6efd", "#0a58ca", "#084298", "#052c65", "#031633"],
|
|
39
|
+
indigo: ["#e0cffc", "#c29ffa", "#a370f7", "#8540f5", "#6610f2", "#520dc2", "#3d0a91", "#290661", "#140330"],
|
|
40
|
+
purple: ["#e2d9f3", "#c5b3e6", "#a98eda", "#8c68cd", "#6f42c1", "#59359a", "#432874", "#2c1a4d", "#160d27"],
|
|
41
|
+
pink: ["#f7d6e6", "#efadce", "#e685b5", "#de5c9d", "#d63384", "#ab296a", "#801f4f", "#561435", "#2b0a1a"],
|
|
42
|
+
red: ["#f8d7da", "#f1aeb5", "#ea868f", "#e35d6a", "#dc3545", "#b02a37", "#842029", "#58151c", "#2c0b0e"],
|
|
43
|
+
orange: ["#ffe5d0", "#fecba1", "#feb272", "#fd9843", "#fd7e14", "#ca6510", "#984c0c", "#653208", "#331904"],
|
|
44
|
+
yellow: ["#fff3cd", "#ffe69c", "#ffda6a", "#ffcd39", "#ffc107", "#cc9a06", "#997404", "#664d03", "#332701"],
|
|
45
|
+
green: ["#d1e7dd", "#a3cfbb", "#75b798", "#479f76", "#198754", "#146c43", "#0f5132", "#0a3622", "#051b11"],
|
|
46
|
+
teal: ["#d2f4ea", "#a6e9d5", "#79dfc1", "#4dd4ac", "#20c997", "#1aa179", "#13795b", "#0d503c", "#06281e"],
|
|
47
|
+
cyan: ["#cff4fc", "#9eeaf9", "#6edff6", "#3dd5f3", "#0dcaf0", "#0aa2c0", "#087990", "#055160", "#032830"]
|
|
48
|
+
}, Z = Object.entries(oe).map(
|
|
49
|
+
([e, n]) => ({
|
|
50
|
+
name: e,
|
|
51
|
+
shades: n.map((t, r) => {
|
|
52
|
+
const o = (r + 1) * 100;
|
|
53
|
+
return { shade: o, token: `${e}-${o}`, hex: t };
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
), q = /* @__PURE__ */ new Map();
|
|
57
|
+
for (const e of Y) q.set(e.token, e.hex);
|
|
58
|
+
for (const e of Z)
|
|
59
|
+
for (const n of e.shades) q.set(n.token, n.hex);
|
|
60
|
+
const Q = /* @__PURE__ */ new Map();
|
|
61
|
+
for (const e of Z)
|
|
62
|
+
for (const n of e.shades) Q.set(n.hex.toLowerCase(), n.token);
|
|
63
|
+
for (const e of Y) Q.set(e.hex.toLowerCase(), e.token);
|
|
64
|
+
function bt(e) {
|
|
65
|
+
return e.startsWith("#");
|
|
66
|
+
}
|
|
67
|
+
function x(e) {
|
|
68
|
+
return bt(e) || e === "transparent" ? e : q.get(e) ?? e;
|
|
69
|
+
}
|
|
70
|
+
function I(e, n) {
|
|
71
|
+
return bt(e) ? null : `${n}-${e}`;
|
|
72
|
+
}
|
|
73
|
+
function ie(e) {
|
|
74
|
+
return Q.get(e.toLowerCase()) ?? null;
|
|
75
|
+
}
|
|
76
|
+
function mt(e, n, t) {
|
|
77
|
+
const r = [], o = [];
|
|
78
|
+
if (e) {
|
|
79
|
+
const s = I(e, "text");
|
|
80
|
+
s ? r.push(s) : o.push(`color: ${x(e)}`);
|
|
81
|
+
}
|
|
82
|
+
if (n) {
|
|
83
|
+
const s = I(n, "bg");
|
|
84
|
+
s ? r.push(s) : o.push(`background-color: ${x(n)}`);
|
|
85
|
+
}
|
|
86
|
+
if (t) {
|
|
87
|
+
const s = I(t, "border");
|
|
88
|
+
s ? r.push(s) : o.push(`border-color: ${x(t)}`);
|
|
89
|
+
}
|
|
90
|
+
return { classes: r, style: o.join("; ") };
|
|
91
|
+
}
|
|
92
|
+
const v = [
|
|
93
|
+
"xs",
|
|
94
|
+
"sm",
|
|
95
|
+
"base",
|
|
96
|
+
"lg",
|
|
97
|
+
"xl",
|
|
98
|
+
"2xl",
|
|
99
|
+
"3xl",
|
|
100
|
+
"4xl",
|
|
101
|
+
"5xl",
|
|
102
|
+
"6xl",
|
|
103
|
+
"7xl"
|
|
104
|
+
], pt = {
|
|
105
|
+
xs: 12,
|
|
106
|
+
sm: 14,
|
|
107
|
+
base: 16,
|
|
108
|
+
lg: 18,
|
|
109
|
+
xl: 20,
|
|
110
|
+
"2xl": 24,
|
|
111
|
+
"3xl": 30,
|
|
112
|
+
"4xl": 36,
|
|
113
|
+
"5xl": 48,
|
|
114
|
+
"6xl": 64,
|
|
115
|
+
"7xl": 80
|
|
116
|
+
}, tt = "base";
|
|
117
|
+
function gt(e) {
|
|
118
|
+
return v.includes(e);
|
|
119
|
+
}
|
|
120
|
+
function M(e) {
|
|
121
|
+
return pt[e];
|
|
122
|
+
}
|
|
123
|
+
function _t(e) {
|
|
124
|
+
return !e || e === "base" || !gt(e) ? null : `text-${e}`;
|
|
125
|
+
}
|
|
126
|
+
function xt(e) {
|
|
127
|
+
return v.find((n) => pt[n] === e) ?? null;
|
|
128
|
+
}
|
|
129
|
+
function F(e, n) {
|
|
130
|
+
const t = e && gt(e) ? e : tt, r = v.indexOf(t), o = Math.max(
|
|
131
|
+
0,
|
|
132
|
+
Math.min(v.length - 1, r + n)
|
|
133
|
+
);
|
|
134
|
+
return v[o];
|
|
135
|
+
}
|
|
136
|
+
const se = /* @__PURE__ */ new Set([
|
|
137
|
+
"primary",
|
|
138
|
+
"secondary",
|
|
139
|
+
"success",
|
|
140
|
+
"danger",
|
|
141
|
+
"warning",
|
|
142
|
+
"info",
|
|
143
|
+
"light",
|
|
144
|
+
"dark"
|
|
145
|
+
]);
|
|
146
|
+
class T extends Kt {
|
|
147
|
+
constructor(t = "#", r = "primary", o = !1, s = null, l = null, c = null, a = null, d) {
|
|
148
|
+
super(d);
|
|
149
|
+
p(this, "__href");
|
|
150
|
+
p(this, "__variant");
|
|
151
|
+
p(this, "__outline");
|
|
152
|
+
p(this, "__textColor");
|
|
153
|
+
p(this, "__bgColor");
|
|
154
|
+
p(this, "__borderColor");
|
|
155
|
+
p(this, "__fontSize");
|
|
156
|
+
this.__href = t, this.__variant = r, this.__outline = o, this.__textColor = s, this.__bgColor = l, this.__borderColor = c, this.__fontSize = a;
|
|
157
|
+
}
|
|
158
|
+
static getType() {
|
|
159
|
+
return "bootstrap-button";
|
|
160
|
+
}
|
|
161
|
+
static clone(t) {
|
|
162
|
+
return new T(
|
|
163
|
+
t.__href,
|
|
164
|
+
t.__variant,
|
|
165
|
+
t.__outline,
|
|
166
|
+
t.__textColor,
|
|
167
|
+
t.__bgColor,
|
|
168
|
+
t.__borderColor,
|
|
169
|
+
t.__fontSize,
|
|
170
|
+
t.__key
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
// --- Rendering -----------------------------------------------------------
|
|
174
|
+
variantClass() {
|
|
175
|
+
return this.__outline ? `btn-outline-${this.__variant}` : `btn-${this.__variant}`;
|
|
176
|
+
}
|
|
177
|
+
buildClassName() {
|
|
178
|
+
return `btn ${this.variantClass()}`;
|
|
179
|
+
}
|
|
180
|
+
applyInlineStyles(t) {
|
|
181
|
+
t.style.color = this.__textColor ? x(this.__textColor) : "", t.style.backgroundColor = this.__bgColor ? x(this.__bgColor) : "", t.style.borderColor = this.__borderColor ? x(this.__borderColor) : "", t.style.fontSize = this.__fontSize ? `${M(this.__fontSize)}px` : "";
|
|
182
|
+
}
|
|
183
|
+
createDOM(t) {
|
|
184
|
+
const r = document.createElement("a");
|
|
185
|
+
return r.href = this.__href, r.className = this.buildClassName(), this.applyInlineStyles(r), r;
|
|
186
|
+
}
|
|
187
|
+
updateDOM(t, r) {
|
|
188
|
+
const o = r;
|
|
189
|
+
return t.__href !== this.__href && (o.href = this.__href), (t.__variant !== this.__variant || t.__outline !== this.__outline) && (o.className = this.buildClassName()), (t.__textColor !== this.__textColor || t.__bgColor !== this.__bgColor || t.__borderColor !== this.__borderColor || t.__fontSize !== this.__fontSize) && this.applyInlineStyles(o), !1;
|
|
190
|
+
}
|
|
191
|
+
// --- HTML import / export ------------------------------------------------
|
|
192
|
+
static importDOM() {
|
|
193
|
+
return {
|
|
194
|
+
a: (t) => t.classList.contains("btn") ? { conversion: le, priority: 1 } : null
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
exportDOM() {
|
|
198
|
+
const t = document.createElement("a");
|
|
199
|
+
t.setAttribute("href", this.__href);
|
|
200
|
+
const { classes: r, style: o } = mt(
|
|
201
|
+
this.__textColor,
|
|
202
|
+
this.__bgColor,
|
|
203
|
+
this.__borderColor
|
|
204
|
+
);
|
|
205
|
+
t.className = [this.buildClassName(), ...r].join(" ");
|
|
206
|
+
const s = o ? [o] : [];
|
|
207
|
+
return this.__fontSize && s.push(`font-size: ${M(this.__fontSize)}px`), s.length && t.setAttribute("style", s.join("; ")), { element: t };
|
|
208
|
+
}
|
|
209
|
+
// --- JSON serialization --------------------------------------------------
|
|
210
|
+
static importJSON(t) {
|
|
211
|
+
const r = et({
|
|
212
|
+
href: t.href,
|
|
213
|
+
variant: t.variant,
|
|
214
|
+
outline: t.outline,
|
|
215
|
+
textColor: t.textColor ?? null,
|
|
216
|
+
bgColor: t.bgColor ?? null,
|
|
217
|
+
borderColor: t.borderColor ?? null,
|
|
218
|
+
fontSize: t.fontSize ?? null
|
|
219
|
+
});
|
|
220
|
+
return r.setFormat(t.format), r.setIndent(t.indent), r.setDirection(t.direction), r;
|
|
221
|
+
}
|
|
222
|
+
exportJSON() {
|
|
223
|
+
return {
|
|
224
|
+
...super.exportJSON(),
|
|
225
|
+
type: "bootstrap-button",
|
|
226
|
+
version: 1,
|
|
227
|
+
href: this.getHref(),
|
|
228
|
+
variant: this.getVariant(),
|
|
229
|
+
outline: this.getOutline(),
|
|
230
|
+
textColor: this.__textColor,
|
|
231
|
+
bgColor: this.__bgColor,
|
|
232
|
+
borderColor: this.__borderColor,
|
|
233
|
+
fontSize: this.__fontSize
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
// --- Accessors -----------------------------------------------------------
|
|
237
|
+
getHref() {
|
|
238
|
+
return this.getLatest().__href;
|
|
239
|
+
}
|
|
240
|
+
setHref(t) {
|
|
241
|
+
const r = this.getWritable();
|
|
242
|
+
return r.__href = t, r;
|
|
243
|
+
}
|
|
244
|
+
getVariant() {
|
|
245
|
+
return this.getLatest().__variant;
|
|
246
|
+
}
|
|
247
|
+
setVariant(t) {
|
|
248
|
+
const r = this.getWritable();
|
|
249
|
+
return r.__variant = t, r;
|
|
250
|
+
}
|
|
251
|
+
getOutline() {
|
|
252
|
+
return this.getLatest().__outline;
|
|
253
|
+
}
|
|
254
|
+
setOutline(t) {
|
|
255
|
+
const r = this.getWritable();
|
|
256
|
+
return r.__outline = t, r;
|
|
257
|
+
}
|
|
258
|
+
getTextColor() {
|
|
259
|
+
return this.getLatest().__textColor;
|
|
260
|
+
}
|
|
261
|
+
setTextColor(t) {
|
|
262
|
+
const r = this.getWritable();
|
|
263
|
+
return r.__textColor = t, r;
|
|
264
|
+
}
|
|
265
|
+
getBgColor() {
|
|
266
|
+
return this.getLatest().__bgColor;
|
|
267
|
+
}
|
|
268
|
+
setBgColor(t) {
|
|
269
|
+
const r = this.getWritable();
|
|
270
|
+
return r.__bgColor = t, r;
|
|
271
|
+
}
|
|
272
|
+
getBorderColor() {
|
|
273
|
+
return this.getLatest().__borderColor;
|
|
274
|
+
}
|
|
275
|
+
setBorderColor(t) {
|
|
276
|
+
const r = this.getWritable();
|
|
277
|
+
return r.__borderColor = t, r;
|
|
278
|
+
}
|
|
279
|
+
getFontSize() {
|
|
280
|
+
return this.getLatest().__fontSize;
|
|
281
|
+
}
|
|
282
|
+
setFontSize(t) {
|
|
283
|
+
const r = this.getWritable();
|
|
284
|
+
return r.__fontSize = t, r;
|
|
285
|
+
}
|
|
286
|
+
// --- Behavior ------------------------------------------------------------
|
|
287
|
+
isInline() {
|
|
288
|
+
return !0;
|
|
289
|
+
}
|
|
290
|
+
canBeEmpty() {
|
|
291
|
+
return !1;
|
|
292
|
+
}
|
|
293
|
+
canInsertTextBefore() {
|
|
294
|
+
return !1;
|
|
295
|
+
}
|
|
296
|
+
canInsertTextAfter() {
|
|
297
|
+
return !1;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function le(e) {
|
|
301
|
+
const n = e, t = Array.from(n.classList).some(
|
|
302
|
+
(s) => s.startsWith("btn-outline-")
|
|
303
|
+
);
|
|
304
|
+
let r = "primary";
|
|
305
|
+
for (const s of Array.from(n.classList)) {
|
|
306
|
+
const l = s.replace(/^btn-outline-/, "").replace(/^btn-/, "");
|
|
307
|
+
if (l !== s && se.has(l)) {
|
|
308
|
+
r = l;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return { node: et({
|
|
313
|
+
href: n.getAttribute("href") ?? "#",
|
|
314
|
+
variant: r,
|
|
315
|
+
outline: t
|
|
316
|
+
}) };
|
|
317
|
+
}
|
|
318
|
+
function et(e = {}) {
|
|
319
|
+
const {
|
|
320
|
+
href: n = "#",
|
|
321
|
+
variant: t = "primary",
|
|
322
|
+
outline: r = !1,
|
|
323
|
+
textColor: o = null,
|
|
324
|
+
bgColor: s = null,
|
|
325
|
+
borderColor: l = null,
|
|
326
|
+
fontSize: c = null
|
|
327
|
+
} = e;
|
|
328
|
+
return X(
|
|
329
|
+
new T(
|
|
330
|
+
n,
|
|
331
|
+
t,
|
|
332
|
+
r,
|
|
333
|
+
o,
|
|
334
|
+
s,
|
|
335
|
+
l,
|
|
336
|
+
c
|
|
337
|
+
)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
function ae(e, n = {}) {
|
|
341
|
+
const t = et(n);
|
|
342
|
+
return t.append(jt(e)), t;
|
|
343
|
+
}
|
|
344
|
+
function rt(e) {
|
|
345
|
+
return e instanceof T;
|
|
346
|
+
}
|
|
347
|
+
function nt(e) {
|
|
348
|
+
switch (e) {
|
|
349
|
+
case "center":
|
|
350
|
+
return "center";
|
|
351
|
+
case "right":
|
|
352
|
+
return "right";
|
|
353
|
+
case "justify":
|
|
354
|
+
return "justify";
|
|
355
|
+
case "left":
|
|
356
|
+
return "left";
|
|
357
|
+
// Logical directions map to physical ones for LTR email content.
|
|
358
|
+
case "start":
|
|
359
|
+
return "left";
|
|
360
|
+
case "end":
|
|
361
|
+
return "right";
|
|
362
|
+
default:
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function ce(e) {
|
|
367
|
+
const n = nt(e);
|
|
368
|
+
return n ? `text-${n}` : null;
|
|
369
|
+
}
|
|
370
|
+
function ue(e) {
|
|
371
|
+
const n = nt(e);
|
|
372
|
+
return !n || n === "justify" ? null : `ax-${n}`;
|
|
373
|
+
}
|
|
374
|
+
class N extends ct {
|
|
375
|
+
constructor(t = null, r = null, o = null, s) {
|
|
376
|
+
super(s);
|
|
377
|
+
p(this, "__textColor");
|
|
378
|
+
p(this, "__bgColor");
|
|
379
|
+
p(this, "__fontSize");
|
|
380
|
+
this.__textColor = t, this.__bgColor = r, this.__fontSize = o;
|
|
381
|
+
}
|
|
382
|
+
static getType() {
|
|
383
|
+
return "bootstrap-paragraph";
|
|
384
|
+
}
|
|
385
|
+
static clone(t) {
|
|
386
|
+
return new N(
|
|
387
|
+
t.__textColor,
|
|
388
|
+
t.__bgColor,
|
|
389
|
+
t.__fontSize,
|
|
390
|
+
t.__key
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
static importJSON(t) {
|
|
394
|
+
const r = new N(
|
|
395
|
+
t.textColor ?? null,
|
|
396
|
+
t.bgColor ?? null,
|
|
397
|
+
t.fontSize ?? null
|
|
398
|
+
);
|
|
399
|
+
return r.setFormat(t.format), r.setIndent(t.indent), r.setDirection(t.direction), r;
|
|
400
|
+
}
|
|
401
|
+
exportJSON() {
|
|
402
|
+
return {
|
|
403
|
+
...super.exportJSON(),
|
|
404
|
+
type: "bootstrap-paragraph",
|
|
405
|
+
version: 1,
|
|
406
|
+
textColor: this.__textColor,
|
|
407
|
+
bgColor: this.__bgColor,
|
|
408
|
+
fontSize: this.__fontSize
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
getFontSize() {
|
|
412
|
+
return this.getLatest().__fontSize;
|
|
413
|
+
}
|
|
414
|
+
setFontSize(t) {
|
|
415
|
+
const r = this.getWritable();
|
|
416
|
+
return r.__fontSize = t, r;
|
|
417
|
+
}
|
|
418
|
+
getTextColor() {
|
|
419
|
+
return this.getLatest().__textColor;
|
|
420
|
+
}
|
|
421
|
+
setTextColor(t) {
|
|
422
|
+
const r = this.getWritable();
|
|
423
|
+
return r.__textColor = t, r;
|
|
424
|
+
}
|
|
425
|
+
getBgColor() {
|
|
426
|
+
return this.getLatest().__bgColor;
|
|
427
|
+
}
|
|
428
|
+
setBgColor(t) {
|
|
429
|
+
const r = this.getWritable();
|
|
430
|
+
return r.__bgColor = t, r;
|
|
431
|
+
}
|
|
432
|
+
applyInlineStyles(t) {
|
|
433
|
+
t.style.color = this.__textColor ? x(this.__textColor) : "", t.style.backgroundColor = this.__bgColor ? x(this.__bgColor) : "", t.style.fontSize = this.__fontSize ? `${M(this.__fontSize)}px` : "";
|
|
434
|
+
}
|
|
435
|
+
createDOM(t) {
|
|
436
|
+
const r = super.createDOM(t);
|
|
437
|
+
return this.applyInlineStyles(r), r;
|
|
438
|
+
}
|
|
439
|
+
updateDOM(t, r, o) {
|
|
440
|
+
return super.updateDOM(t, r, o) ? !0 : (this.applyInlineStyles(r), !1);
|
|
441
|
+
}
|
|
442
|
+
hasButtonChild() {
|
|
443
|
+
return this.getChildren().some(
|
|
444
|
+
(t) => rt(t)
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
exportDOM() {
|
|
448
|
+
const t = document.createElement("div"), r = [], o = this.hasButtonChild() ? ue(this.getFormatType()) : ce(this.getFormatType());
|
|
449
|
+
o && r.push(o);
|
|
450
|
+
const { classes: s, style: l } = mt(
|
|
451
|
+
this.__textColor,
|
|
452
|
+
this.__bgColor
|
|
453
|
+
);
|
|
454
|
+
r.push(...s);
|
|
455
|
+
const c = _t(this.__fontSize);
|
|
456
|
+
return c && r.push(c), r.length && (t.className = r.join(" ")), l && t.setAttribute("style", l), this.getChildrenSize() === 0 && t.appendChild(document.createElement("br")), { element: t };
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
const J = [
|
|
460
|
+
{ key: "0", px: 0 },
|
|
461
|
+
{ key: "1", px: 4 },
|
|
462
|
+
{ key: "2", px: 8 },
|
|
463
|
+
{ key: "3", px: 12 },
|
|
464
|
+
{ key: "4", px: 16 },
|
|
465
|
+
{ key: "5", px: 20 },
|
|
466
|
+
{ key: "6", px: 24 },
|
|
467
|
+
{ key: "7", px: 28 },
|
|
468
|
+
{ key: "8", px: 32 },
|
|
469
|
+
{ key: "9", px: 36 },
|
|
470
|
+
{ key: "10", px: 40 },
|
|
471
|
+
{ key: "12", px: 48 },
|
|
472
|
+
{ key: "16", px: 64 },
|
|
473
|
+
{ key: "20", px: 80 },
|
|
474
|
+
{ key: "24", px: 96 },
|
|
475
|
+
{ key: "32", px: 128 },
|
|
476
|
+
{ key: "40", px: 160 },
|
|
477
|
+
{ key: "48", px: 192 },
|
|
478
|
+
{ key: "56", px: 224 },
|
|
479
|
+
{ key: "64", px: 256 },
|
|
480
|
+
{ key: "80", px: 320 },
|
|
481
|
+
{ key: "96", px: 384 },
|
|
482
|
+
{ key: "112", px: 448 },
|
|
483
|
+
{ key: "128", px: 512 },
|
|
484
|
+
{ key: "144", px: 576 },
|
|
485
|
+
{ key: "150", px: 600 }
|
|
486
|
+
];
|
|
487
|
+
function R(e) {
|
|
488
|
+
var n;
|
|
489
|
+
return e ? ((n = J.find((t) => t.key === e)) == null ? void 0 : n.px) ?? null : null;
|
|
490
|
+
}
|
|
491
|
+
function he(e, n, t) {
|
|
492
|
+
if (e === "fixed") {
|
|
493
|
+
const r = [];
|
|
494
|
+
return n && r.push(`w-${n}`), t && r.push(`h-${t}`), r.length ? r : ["img-fluid"];
|
|
495
|
+
}
|
|
496
|
+
return e === "max" ? n ? [`max-w-${n}`, "w-full"] : ["img-fluid"] : ["img-fluid"];
|
|
497
|
+
}
|
|
498
|
+
function de(e) {
|
|
499
|
+
let n = "fluid", t = null, r = null;
|
|
500
|
+
for (const o of e) {
|
|
501
|
+
const s = o.match(/^max-w-(.+)$/), l = o.match(/^w-(.+)$/), c = o.match(/^h-(.+)$/);
|
|
502
|
+
s && s[1] !== "full" ? (n = "max", t = s[1]) : l && l[1] !== "full" && l[1] !== "auto" ? (n = "fixed", t = l[1]) : c && c[1] !== "full" && c[1] !== "auto" && (n = "fixed", r = c[1]);
|
|
503
|
+
}
|
|
504
|
+
return { mode: n, width: t, height: r };
|
|
505
|
+
}
|
|
506
|
+
function fe(e, n, t) {
|
|
507
|
+
if (e === "fixed") {
|
|
508
|
+
const r = R(n), o = R(t);
|
|
509
|
+
return r !== null ? { width: `${r}px`, height: "auto" } : o !== null ? { width: "auto", height: `${o}px` } : { width: "auto", height: "auto" };
|
|
510
|
+
}
|
|
511
|
+
if (e === "max") {
|
|
512
|
+
const r = R(n);
|
|
513
|
+
return {
|
|
514
|
+
maxWidth: r !== null ? `${r}px` : "100%",
|
|
515
|
+
width: "100%",
|
|
516
|
+
height: "auto"
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
return { maxWidth: "100%", width: "100%", height: "auto" };
|
|
520
|
+
}
|
|
521
|
+
function B({
|
|
522
|
+
label: e,
|
|
523
|
+
steps: n,
|
|
524
|
+
value: t,
|
|
525
|
+
fallbackKey: r,
|
|
526
|
+
onChange: o
|
|
527
|
+
}) {
|
|
528
|
+
var a;
|
|
529
|
+
const s = t ?? r, l = Math.max(
|
|
530
|
+
0,
|
|
531
|
+
n.findIndex((d) => d.key === s)
|
|
532
|
+
), c = ((a = n[l]) == null ? void 0 : a.px) ?? 0;
|
|
533
|
+
return /* @__PURE__ */ b("label", { className: "bew-slider", children: [
|
|
534
|
+
/* @__PURE__ */ b("span", { className: "bew-slider-head", children: [
|
|
535
|
+
e,
|
|
536
|
+
/* @__PURE__ */ b("span", { className: "bew-slider-px", children: [
|
|
537
|
+
c,
|
|
538
|
+
"px"
|
|
539
|
+
] })
|
|
540
|
+
] }),
|
|
541
|
+
/* @__PURE__ */ i(
|
|
542
|
+
"input",
|
|
543
|
+
{
|
|
544
|
+
type: "range",
|
|
545
|
+
min: 0,
|
|
546
|
+
max: n.length - 1,
|
|
547
|
+
step: 1,
|
|
548
|
+
value: l,
|
|
549
|
+
onChange: (d) => o(n[Number(d.target.value)].key)
|
|
550
|
+
}
|
|
551
|
+
)
|
|
552
|
+
] });
|
|
553
|
+
}
|
|
554
|
+
const be = [
|
|
555
|
+
{ mode: "fluid", label: "Full width" },
|
|
556
|
+
{ mode: "fixed", label: "Fixed size" },
|
|
557
|
+
{ mode: "max", label: "Max width" }
|
|
558
|
+
];
|
|
559
|
+
function me({
|
|
560
|
+
nodeKey: e,
|
|
561
|
+
src: n,
|
|
562
|
+
alt: t,
|
|
563
|
+
mode: r,
|
|
564
|
+
width: o,
|
|
565
|
+
height: s
|
|
566
|
+
}) {
|
|
567
|
+
const [l] = E(), [c, a] = C(!1), d = (h) => {
|
|
568
|
+
l.update(() => {
|
|
569
|
+
const m = ut(e);
|
|
570
|
+
ge(m) && h(m);
|
|
571
|
+
});
|
|
572
|
+
}, g = (h) => {
|
|
573
|
+
d((m) => {
|
|
574
|
+
m.setMode(h), h === "fluid" ? (m.setWidth(null), m.setHeight(null)) : h === "fixed" ? !m.getWidth() && !m.getHeight() && m.setWidth("64") : h === "max" && (m.setHeight(null), m.getWidth() || m.setWidth("96"));
|
|
575
|
+
});
|
|
576
|
+
}, f = s !== null ? "height" : "width";
|
|
577
|
+
return (
|
|
578
|
+
// The container is block-level and does NOT resize with the image, so the
|
|
579
|
+
// settings panel stays anchored while the image (and its wrap) grow.
|
|
580
|
+
/* @__PURE__ */ b("div", { className: "bew-image-container", children: [
|
|
581
|
+
/* @__PURE__ */ b("span", { className: "bew-image-wrap", draggable: !1, children: [
|
|
582
|
+
/* @__PURE__ */ i(
|
|
583
|
+
"img",
|
|
584
|
+
{
|
|
585
|
+
src: n,
|
|
586
|
+
alt: t,
|
|
587
|
+
className: "bew-image",
|
|
588
|
+
style: fe(r, o, s)
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ i(
|
|
592
|
+
"button",
|
|
593
|
+
{
|
|
594
|
+
type: "button",
|
|
595
|
+
className: "bew-image-gear",
|
|
596
|
+
"aria-label": "Image settings",
|
|
597
|
+
onClick: () => a((h) => !h),
|
|
598
|
+
children: "⚙"
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
] }),
|
|
602
|
+
c && /* @__PURE__ */ b("div", { className: "bew-image-panel", children: [
|
|
603
|
+
/* @__PURE__ */ i("div", { className: "bew-image-modes", children: be.map((h) => /* @__PURE__ */ i(
|
|
604
|
+
"button",
|
|
605
|
+
{
|
|
606
|
+
type: "button",
|
|
607
|
+
className: `bew-image-mode${r === h.mode ? " is-active" : ""}`,
|
|
608
|
+
onClick: () => g(h.mode),
|
|
609
|
+
children: h.label
|
|
610
|
+
},
|
|
611
|
+
h.mode
|
|
612
|
+
)) }),
|
|
613
|
+
r === "fixed" && /* @__PURE__ */ b(Mt, { children: [
|
|
614
|
+
/* @__PURE__ */ b("div", { className: "bew-image-modes", children: [
|
|
615
|
+
/* @__PURE__ */ i(
|
|
616
|
+
"button",
|
|
617
|
+
{
|
|
618
|
+
type: "button",
|
|
619
|
+
className: `bew-image-mode${f === "width" ? " is-active" : ""}`,
|
|
620
|
+
onClick: () => d((h) => {
|
|
621
|
+
h.setHeight(null), h.getWidth() || h.setWidth("64");
|
|
622
|
+
}),
|
|
623
|
+
children: "Width"
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
/* @__PURE__ */ i(
|
|
627
|
+
"button",
|
|
628
|
+
{
|
|
629
|
+
type: "button",
|
|
630
|
+
className: `bew-image-mode${f === "height" ? " is-active" : ""}`,
|
|
631
|
+
onClick: () => d((h) => {
|
|
632
|
+
h.setWidth(null), h.getHeight() || h.setHeight("48");
|
|
633
|
+
}),
|
|
634
|
+
children: "Height"
|
|
635
|
+
}
|
|
636
|
+
)
|
|
637
|
+
] }),
|
|
638
|
+
/* @__PURE__ */ i(
|
|
639
|
+
B,
|
|
640
|
+
{
|
|
641
|
+
label: f === "width" ? "Width" : "Height",
|
|
642
|
+
steps: J,
|
|
643
|
+
value: f === "width" ? o : s,
|
|
644
|
+
fallbackKey: f === "width" ? "64" : "48",
|
|
645
|
+
onChange: (h) => d((m) => {
|
|
646
|
+
f === "width" ? (m.setWidth(h), m.setHeight(null)) : (m.setHeight(h), m.setWidth(null));
|
|
647
|
+
})
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
] }),
|
|
651
|
+
r === "max" && /* @__PURE__ */ i(
|
|
652
|
+
B,
|
|
653
|
+
{
|
|
654
|
+
label: "Max width",
|
|
655
|
+
steps: J,
|
|
656
|
+
value: o,
|
|
657
|
+
fallbackKey: "96",
|
|
658
|
+
onChange: (h) => d((m) => m.setWidth(h))
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
] })
|
|
662
|
+
] })
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
class O extends ht {
|
|
666
|
+
constructor(t, r = "", o = "fluid", s = null, l = null, c) {
|
|
667
|
+
super(c);
|
|
668
|
+
p(this, "__src");
|
|
669
|
+
p(this, "__alt");
|
|
670
|
+
p(this, "__mode");
|
|
671
|
+
p(this, "__width");
|
|
672
|
+
p(this, "__height");
|
|
673
|
+
this.__src = t, this.__alt = r, this.__mode = o, this.__width = s, this.__height = l;
|
|
674
|
+
}
|
|
675
|
+
static getType() {
|
|
676
|
+
return "bootstrap-image";
|
|
677
|
+
}
|
|
678
|
+
static clone(t) {
|
|
679
|
+
return new O(
|
|
680
|
+
t.__src,
|
|
681
|
+
t.__alt,
|
|
682
|
+
t.__mode,
|
|
683
|
+
t.__width,
|
|
684
|
+
t.__height,
|
|
685
|
+
t.__key
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
static importJSON(t) {
|
|
689
|
+
return ot({
|
|
690
|
+
src: t.src,
|
|
691
|
+
alt: t.alt,
|
|
692
|
+
mode: t.mode,
|
|
693
|
+
width: t.width,
|
|
694
|
+
height: t.height
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
exportJSON() {
|
|
698
|
+
return {
|
|
699
|
+
type: "bootstrap-image",
|
|
700
|
+
version: 1,
|
|
701
|
+
src: this.__src,
|
|
702
|
+
alt: this.__alt,
|
|
703
|
+
mode: this.__mode,
|
|
704
|
+
width: this.__width,
|
|
705
|
+
height: this.__height
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
static importDOM() {
|
|
709
|
+
return {
|
|
710
|
+
img: () => ({ conversion: pe, priority: 0 })
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
exportDOM() {
|
|
714
|
+
const t = document.createElement("img");
|
|
715
|
+
return t.setAttribute("src", this.__src), t.setAttribute("alt", this.__alt), t.className = he(
|
|
716
|
+
this.__mode,
|
|
717
|
+
this.__width,
|
|
718
|
+
this.__height
|
|
719
|
+
).join(" "), { element: t };
|
|
720
|
+
}
|
|
721
|
+
// --- Accessors -----------------------------------------------------------
|
|
722
|
+
getSrc() {
|
|
723
|
+
return this.getLatest().__src;
|
|
724
|
+
}
|
|
725
|
+
setSrc(t) {
|
|
726
|
+
const r = this.getWritable();
|
|
727
|
+
return r.__src = t, r;
|
|
728
|
+
}
|
|
729
|
+
getAlt() {
|
|
730
|
+
return this.getLatest().__alt;
|
|
731
|
+
}
|
|
732
|
+
setAlt(t) {
|
|
733
|
+
const r = this.getWritable();
|
|
734
|
+
return r.__alt = t, r;
|
|
735
|
+
}
|
|
736
|
+
getMode() {
|
|
737
|
+
return this.getLatest().__mode;
|
|
738
|
+
}
|
|
739
|
+
setMode(t) {
|
|
740
|
+
const r = this.getWritable();
|
|
741
|
+
return r.__mode = t, r;
|
|
742
|
+
}
|
|
743
|
+
getWidth() {
|
|
744
|
+
return this.getLatest().__width;
|
|
745
|
+
}
|
|
746
|
+
setWidth(t) {
|
|
747
|
+
const r = this.getWritable();
|
|
748
|
+
return r.__width = t, r;
|
|
749
|
+
}
|
|
750
|
+
getHeight() {
|
|
751
|
+
return this.getLatest().__height;
|
|
752
|
+
}
|
|
753
|
+
setHeight(t) {
|
|
754
|
+
const r = this.getWritable();
|
|
755
|
+
return r.__height = t, r;
|
|
756
|
+
}
|
|
757
|
+
// --- Rendering -----------------------------------------------------------
|
|
758
|
+
createDOM() {
|
|
759
|
+
const t = document.createElement("div");
|
|
760
|
+
return t.className = "bew-image-block", t;
|
|
761
|
+
}
|
|
762
|
+
updateDOM() {
|
|
763
|
+
return !1;
|
|
764
|
+
}
|
|
765
|
+
isInline() {
|
|
766
|
+
return !1;
|
|
767
|
+
}
|
|
768
|
+
decorate() {
|
|
769
|
+
return /* @__PURE__ */ i(
|
|
770
|
+
me,
|
|
771
|
+
{
|
|
772
|
+
nodeKey: this.getKey(),
|
|
773
|
+
src: this.__src,
|
|
774
|
+
alt: this.__alt,
|
|
775
|
+
mode: this.__mode,
|
|
776
|
+
width: this.__width,
|
|
777
|
+
height: this.__height
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function pe(e) {
|
|
783
|
+
const n = e, t = n.getAttribute("src");
|
|
784
|
+
if (!t) return null;
|
|
785
|
+
const r = n.getAttribute("alt") ?? "", { mode: o, width: s, height: l } = de(Array.from(n.classList));
|
|
786
|
+
return { node: ot({ src: t, alt: r, mode: o, width: s, height: l }) };
|
|
787
|
+
}
|
|
788
|
+
function ot(e) {
|
|
789
|
+
const { src: n, alt: t = "", mode: r = "fluid", width: o = null, height: s = null, key: l } = e;
|
|
790
|
+
return X(
|
|
791
|
+
new O(n, t, r, o, s, l)
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
function ge(e) {
|
|
795
|
+
return e instanceof O;
|
|
796
|
+
}
|
|
797
|
+
const U = [
|
|
798
|
+
{ key: "0", px: 0 },
|
|
799
|
+
{ key: "1", px: 4 },
|
|
800
|
+
{ key: "2", px: 8 },
|
|
801
|
+
{ key: "3", px: 12 },
|
|
802
|
+
{ key: "4", px: 16 },
|
|
803
|
+
{ key: "5", px: 20 },
|
|
804
|
+
{ key: "6", px: 24 },
|
|
805
|
+
{ key: "7", px: 28 },
|
|
806
|
+
{ key: "8", px: 32 },
|
|
807
|
+
{ key: "9", px: 36 },
|
|
808
|
+
{ key: "10", px: 40 },
|
|
809
|
+
{ key: "12", px: 48 },
|
|
810
|
+
{ key: "16", px: 64 },
|
|
811
|
+
{ key: "20", px: 80 },
|
|
812
|
+
{ key: "24", px: 96 },
|
|
813
|
+
{ key: "32", px: 128 },
|
|
814
|
+
{ key: "40", px: 160 }
|
|
815
|
+
], w = "5";
|
|
816
|
+
function lt(e) {
|
|
817
|
+
var n;
|
|
818
|
+
return ((n = U.find((t) => t.key === e)) == null ? void 0 : n.px) ?? 0;
|
|
819
|
+
}
|
|
820
|
+
function _e(e, n) {
|
|
821
|
+
return [`mt-${e}`, `mb-${n}`];
|
|
822
|
+
}
|
|
823
|
+
function xe(e) {
|
|
824
|
+
let n = w, t = w;
|
|
825
|
+
for (const r of e) {
|
|
826
|
+
const o = r.match(/^my-(.+)$/), s = r.match(/^mt-(.+)$/), l = r.match(/^mb-(.+)$/);
|
|
827
|
+
o ? (n = o[1], t = o[1]) : s ? n = s[1] : l && (t = l[1]);
|
|
828
|
+
}
|
|
829
|
+
return { top: n, bottom: t };
|
|
830
|
+
}
|
|
831
|
+
function ye({ nodeKey: e, top: n, bottom: t }) {
|
|
832
|
+
const [r] = E(), [o, s] = C(!1), l = (c) => {
|
|
833
|
+
r.update(() => {
|
|
834
|
+
const a = ut(e);
|
|
835
|
+
we(a) && c(a);
|
|
836
|
+
});
|
|
837
|
+
};
|
|
838
|
+
return (
|
|
839
|
+
// Container stays a stable positioning context; the rule moves with its
|
|
840
|
+
// margins but the gear/panel stay anchored (no flicker while dragging).
|
|
841
|
+
/* @__PURE__ */ b("div", { className: "bew-hr-container", children: [
|
|
842
|
+
/* @__PURE__ */ i(
|
|
843
|
+
"hr",
|
|
844
|
+
{
|
|
845
|
+
className: "bew-hr",
|
|
846
|
+
style: {
|
|
847
|
+
marginTop: `${lt(n)}px`,
|
|
848
|
+
marginBottom: `${lt(t)}px`
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
),
|
|
852
|
+
/* @__PURE__ */ i(
|
|
853
|
+
"button",
|
|
854
|
+
{
|
|
855
|
+
type: "button",
|
|
856
|
+
className: "bew-hr-gear",
|
|
857
|
+
"aria-label": "Separator settings",
|
|
858
|
+
onClick: () => s((c) => !c),
|
|
859
|
+
children: "⚙"
|
|
860
|
+
}
|
|
861
|
+
),
|
|
862
|
+
o && /* @__PURE__ */ b("div", { className: "bew-hr-panel", children: [
|
|
863
|
+
/* @__PURE__ */ i(
|
|
864
|
+
B,
|
|
865
|
+
{
|
|
866
|
+
label: "Top spacing",
|
|
867
|
+
steps: U,
|
|
868
|
+
value: n,
|
|
869
|
+
fallbackKey: w,
|
|
870
|
+
onChange: (c) => l((a) => a.setTop(c))
|
|
871
|
+
}
|
|
872
|
+
),
|
|
873
|
+
/* @__PURE__ */ i(
|
|
874
|
+
B,
|
|
875
|
+
{
|
|
876
|
+
label: "Bottom spacing",
|
|
877
|
+
steps: U,
|
|
878
|
+
value: t,
|
|
879
|
+
fallbackKey: w,
|
|
880
|
+
onChange: (c) => l((a) => a.setBottom(c))
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
] })
|
|
884
|
+
] })
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
class A extends ht {
|
|
888
|
+
constructor(t = w, r = w, o) {
|
|
889
|
+
super(o);
|
|
890
|
+
p(this, "__top");
|
|
891
|
+
p(this, "__bottom");
|
|
892
|
+
this.__top = t, this.__bottom = r;
|
|
893
|
+
}
|
|
894
|
+
static getType() {
|
|
895
|
+
return "bootstrap-hr";
|
|
896
|
+
}
|
|
897
|
+
static clone(t) {
|
|
898
|
+
return new A(t.__top, t.__bottom, t.__key);
|
|
899
|
+
}
|
|
900
|
+
static importJSON(t) {
|
|
901
|
+
return it({
|
|
902
|
+
top: t.top,
|
|
903
|
+
bottom: t.bottom
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
exportJSON() {
|
|
907
|
+
return {
|
|
908
|
+
type: "bootstrap-hr",
|
|
909
|
+
version: 1,
|
|
910
|
+
top: this.__top,
|
|
911
|
+
bottom: this.__bottom
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
static importDOM() {
|
|
915
|
+
return { hr: () => ({ conversion: Ce, priority: 0 }) };
|
|
916
|
+
}
|
|
917
|
+
exportDOM() {
|
|
918
|
+
const t = document.createElement("hr");
|
|
919
|
+
return t.className = _e(this.__top, this.__bottom).join(" "), { element: t };
|
|
920
|
+
}
|
|
921
|
+
getTop() {
|
|
922
|
+
return this.getLatest().__top;
|
|
923
|
+
}
|
|
924
|
+
setTop(t) {
|
|
925
|
+
const r = this.getWritable();
|
|
926
|
+
return r.__top = t, r;
|
|
927
|
+
}
|
|
928
|
+
getBottom() {
|
|
929
|
+
return this.getLatest().__bottom;
|
|
930
|
+
}
|
|
931
|
+
setBottom(t) {
|
|
932
|
+
const r = this.getWritable();
|
|
933
|
+
return r.__bottom = t, r;
|
|
934
|
+
}
|
|
935
|
+
createDOM() {
|
|
936
|
+
const t = document.createElement("div");
|
|
937
|
+
return t.className = "bew-hr-block", t;
|
|
938
|
+
}
|
|
939
|
+
updateDOM() {
|
|
940
|
+
return !1;
|
|
941
|
+
}
|
|
942
|
+
isInline() {
|
|
943
|
+
return !1;
|
|
944
|
+
}
|
|
945
|
+
decorate() {
|
|
946
|
+
return /* @__PURE__ */ i(
|
|
947
|
+
ye,
|
|
948
|
+
{
|
|
949
|
+
nodeKey: this.getKey(),
|
|
950
|
+
top: this.__top,
|
|
951
|
+
bottom: this.__bottom
|
|
952
|
+
}
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
function Ce(e) {
|
|
957
|
+
const { top: n, bottom: t } = xe(Array.from(e.classList));
|
|
958
|
+
return { node: it({ top: n, bottom: t }) };
|
|
959
|
+
}
|
|
960
|
+
function it(e = {}) {
|
|
961
|
+
const { top: n = w, bottom: t = w, key: r } = e;
|
|
962
|
+
return X(new A(n, t, r));
|
|
963
|
+
}
|
|
964
|
+
function we(e) {
|
|
965
|
+
return e instanceof A;
|
|
966
|
+
}
|
|
967
|
+
function ke(e, n = {}) {
|
|
968
|
+
const { label: t = "Button", ...r } = n;
|
|
969
|
+
e.update(() => {
|
|
970
|
+
const o = D();
|
|
971
|
+
W(o) && Pt([ae(t, r)]);
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function Ne(e, n) {
|
|
975
|
+
e.update(() => {
|
|
976
|
+
dt(ot(n));
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
function Se(e, n = {}) {
|
|
980
|
+
e.update(() => {
|
|
981
|
+
dt(it(n));
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
const ve = {
|
|
985
|
+
variant: "primary",
|
|
986
|
+
outline: !1,
|
|
987
|
+
textColor: null,
|
|
988
|
+
bgColor: null,
|
|
989
|
+
borderColor: null,
|
|
990
|
+
fontSize: null
|
|
991
|
+
};
|
|
992
|
+
let yt = { ...ve };
|
|
993
|
+
function $e() {
|
|
994
|
+
return { ...yt };
|
|
995
|
+
}
|
|
996
|
+
function Ct(e) {
|
|
997
|
+
yt = { ...e };
|
|
998
|
+
}
|
|
999
|
+
function wt(e) {
|
|
1000
|
+
return {
|
|
1001
|
+
variant: e.getVariant(),
|
|
1002
|
+
outline: e.getOutline(),
|
|
1003
|
+
textColor: e.getTextColor(),
|
|
1004
|
+
bgColor: e.getBgColor(),
|
|
1005
|
+
borderColor: e.getBorderColor(),
|
|
1006
|
+
fontSize: e.getFontSize()
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
function Le(e) {
|
|
1010
|
+
return e !== null && typeof e.setTextColor == "function";
|
|
1011
|
+
}
|
|
1012
|
+
function Ee(e, n, t) {
|
|
1013
|
+
n === "text" ? e.setTextColor(t) : n === "bg" && e.setBgColor(t);
|
|
1014
|
+
}
|
|
1015
|
+
function Te(e, n, t) {
|
|
1016
|
+
const r = n === "text" ? e.setTextColor(t) : n === "bg" ? e.setBgColor(t) : e.setBorderColor(t);
|
|
1017
|
+
Ct(wt(r));
|
|
1018
|
+
}
|
|
1019
|
+
function Oe(e, n) {
|
|
1020
|
+
const t = D();
|
|
1021
|
+
if (!W(t)) return;
|
|
1022
|
+
const r = t.anchor.getNode();
|
|
1023
|
+
let o = r;
|
|
1024
|
+
for (; o !== null; ) {
|
|
1025
|
+
if (rt(o)) {
|
|
1026
|
+
Te(o, e, n);
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
o = o.getParent();
|
|
1030
|
+
}
|
|
1031
|
+
if (e === "border") return;
|
|
1032
|
+
if (t.isCollapsed()) {
|
|
1033
|
+
const l = r.getKey() === "root" ? null : r.getTopLevelElementOrThrow();
|
|
1034
|
+
Le(l) && Ee(l, e, n);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
ft(t, {
|
|
1038
|
+
[e === "text" ? "color" : "background-color"]: n ? x(n) : null
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
function Ae(e, n, t) {
|
|
1042
|
+
e.update(() => Oe(n, t));
|
|
1043
|
+
}
|
|
1044
|
+
function Ie(e) {
|
|
1045
|
+
return e !== null && typeof e.setFontSize == "function";
|
|
1046
|
+
}
|
|
1047
|
+
function at(e) {
|
|
1048
|
+
return e === tt ? null : e;
|
|
1049
|
+
}
|
|
1050
|
+
function Me(e) {
|
|
1051
|
+
const n = e === "increase" ? 1 : -1, t = D();
|
|
1052
|
+
if (!W(t)) return;
|
|
1053
|
+
const r = t.anchor.getNode();
|
|
1054
|
+
let o = r;
|
|
1055
|
+
for (; o !== null; ) {
|
|
1056
|
+
if (rt(o)) {
|
|
1057
|
+
const d = F(o.getFontSize(), n), g = o.setFontSize(at(d));
|
|
1058
|
+
Ct(wt(g));
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
o = o.getParent();
|
|
1062
|
+
}
|
|
1063
|
+
if (t.isCollapsed()) {
|
|
1064
|
+
const d = r.getKey() === "root" ? null : r.getTopLevelElementOrThrow();
|
|
1065
|
+
if (Ie(d)) {
|
|
1066
|
+
const g = F(d.getFontSize(), n);
|
|
1067
|
+
d.setFontSize(at(g));
|
|
1068
|
+
}
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
const s = ee(
|
|
1072
|
+
t,
|
|
1073
|
+
"font-size",
|
|
1074
|
+
""
|
|
1075
|
+
), l = parseInt(s, 10), c = Number.isNaN(l) ? null : xt(l), a = F(c, n);
|
|
1076
|
+
ft(t, {
|
|
1077
|
+
"font-size": a === tt ? null : `${M(a)}px`
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
function Be(e, n) {
|
|
1081
|
+
e.update(() => Me(n));
|
|
1082
|
+
}
|
|
1083
|
+
const kt = "bew:custom-colors", G = /* @__PURE__ */ new Set();
|
|
1084
|
+
let k = null;
|
|
1085
|
+
function z() {
|
|
1086
|
+
if (k) return k;
|
|
1087
|
+
try {
|
|
1088
|
+
if (typeof localStorage < "u") {
|
|
1089
|
+
const e = localStorage.getItem(kt);
|
|
1090
|
+
k = e ? JSON.parse(e) : [];
|
|
1091
|
+
} else
|
|
1092
|
+
k = [];
|
|
1093
|
+
} catch {
|
|
1094
|
+
k = [];
|
|
1095
|
+
}
|
|
1096
|
+
return k;
|
|
1097
|
+
}
|
|
1098
|
+
function Nt(e) {
|
|
1099
|
+
k = e;
|
|
1100
|
+
try {
|
|
1101
|
+
typeof localStorage < "u" && localStorage.setItem(kt, JSON.stringify(e));
|
|
1102
|
+
} catch {
|
|
1103
|
+
}
|
|
1104
|
+
G.forEach((n) => n(e));
|
|
1105
|
+
}
|
|
1106
|
+
function gr() {
|
|
1107
|
+
return z();
|
|
1108
|
+
}
|
|
1109
|
+
function De(e) {
|
|
1110
|
+
const n = e.toLowerCase(), t = z();
|
|
1111
|
+
t.includes(n) || Nt([...t, n]);
|
|
1112
|
+
}
|
|
1113
|
+
function We(e) {
|
|
1114
|
+
const n = e.toLowerCase();
|
|
1115
|
+
Nt(z().filter((t) => t !== n));
|
|
1116
|
+
}
|
|
1117
|
+
function ze() {
|
|
1118
|
+
const [e, n] = C(z);
|
|
1119
|
+
return L(() => (G.add(n), () => {
|
|
1120
|
+
G.delete(n);
|
|
1121
|
+
}), []), e;
|
|
1122
|
+
}
|
|
1123
|
+
function j({ hex: e, token: n, title: t, onSelect: r, onRemove: o }) {
|
|
1124
|
+
const s = e === "transparent";
|
|
1125
|
+
return /* @__PURE__ */ i(
|
|
1126
|
+
"button",
|
|
1127
|
+
{
|
|
1128
|
+
type: "button",
|
|
1129
|
+
className: `bew-swatch${s ? " bew-swatch--transparent" : ""}`,
|
|
1130
|
+
style: s ? void 0 : { backgroundColor: e },
|
|
1131
|
+
title: t,
|
|
1132
|
+
"aria-label": t,
|
|
1133
|
+
onClick: () => r(n),
|
|
1134
|
+
onContextMenu: o ? (l) => {
|
|
1135
|
+
l.preventDefault(), o();
|
|
1136
|
+
} : void 0
|
|
1137
|
+
}
|
|
1138
|
+
);
|
|
1139
|
+
}
|
|
1140
|
+
function K({ onSelect: e }) {
|
|
1141
|
+
const n = ze(), t = V(null);
|
|
1142
|
+
return /* @__PURE__ */ b("div", { className: "bew-color-picker", children: [
|
|
1143
|
+
/* @__PURE__ */ b(
|
|
1144
|
+
"button",
|
|
1145
|
+
{
|
|
1146
|
+
type: "button",
|
|
1147
|
+
className: "bew-color-clear",
|
|
1148
|
+
onClick: () => e(null),
|
|
1149
|
+
children: [
|
|
1150
|
+
/* @__PURE__ */ i("span", { className: "bew-color-clear-swatch" }),
|
|
1151
|
+
"No color"
|
|
1152
|
+
]
|
|
1153
|
+
}
|
|
1154
|
+
),
|
|
1155
|
+
/* @__PURE__ */ i("div", { className: "bew-color-row", children: Y.map((r) => /* @__PURE__ */ i(
|
|
1156
|
+
j,
|
|
1157
|
+
{
|
|
1158
|
+
hex: r.hex,
|
|
1159
|
+
token: r.token,
|
|
1160
|
+
title: r.token,
|
|
1161
|
+
onSelect: e
|
|
1162
|
+
},
|
|
1163
|
+
r.token
|
|
1164
|
+
)) }),
|
|
1165
|
+
/* @__PURE__ */ i("div", { className: "bew-color-grid", children: Z.map((r) => /* @__PURE__ */ i("div", { className: "bew-color-grid-row", children: [...r.shades].reverse().map((o) => /* @__PURE__ */ i(
|
|
1166
|
+
j,
|
|
1167
|
+
{
|
|
1168
|
+
hex: o.hex,
|
|
1169
|
+
token: o.token,
|
|
1170
|
+
title: o.token,
|
|
1171
|
+
onSelect: e
|
|
1172
|
+
},
|
|
1173
|
+
o.token
|
|
1174
|
+
)) }, r.name)) }),
|
|
1175
|
+
/* @__PURE__ */ b("div", { className: "bew-color-custom", children: [
|
|
1176
|
+
/* @__PURE__ */ i("span", { className: "bew-color-custom-label", children: "Custom" }),
|
|
1177
|
+
/* @__PURE__ */ b("div", { className: "bew-color-row", children: [
|
|
1178
|
+
n.map((r) => /* @__PURE__ */ i(
|
|
1179
|
+
j,
|
|
1180
|
+
{
|
|
1181
|
+
hex: r,
|
|
1182
|
+
token: r,
|
|
1183
|
+
title: `${r} (right-click to remove)`,
|
|
1184
|
+
onSelect: e,
|
|
1185
|
+
onRemove: () => We(r)
|
|
1186
|
+
},
|
|
1187
|
+
r
|
|
1188
|
+
)),
|
|
1189
|
+
/* @__PURE__ */ i(
|
|
1190
|
+
"button",
|
|
1191
|
+
{
|
|
1192
|
+
type: "button",
|
|
1193
|
+
className: "bew-swatch bew-swatch--add",
|
|
1194
|
+
title: "Add a custom color",
|
|
1195
|
+
"aria-label": "Add a custom color",
|
|
1196
|
+
onClick: () => {
|
|
1197
|
+
var r;
|
|
1198
|
+
return (r = t.current) == null ? void 0 : r.click();
|
|
1199
|
+
},
|
|
1200
|
+
children: "+"
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
/* @__PURE__ */ i(
|
|
1204
|
+
"input",
|
|
1205
|
+
{
|
|
1206
|
+
ref: t,
|
|
1207
|
+
type: "color",
|
|
1208
|
+
className: "bew-color-input",
|
|
1209
|
+
onChange: (r) => {
|
|
1210
|
+
const o = r.target.value.toLowerCase();
|
|
1211
|
+
De(o), e(o);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1215
|
+
] })
|
|
1216
|
+
] })
|
|
1217
|
+
] });
|
|
1218
|
+
}
|
|
1219
|
+
function S(...e) {
|
|
1220
|
+
return e.filter(Boolean).join(" ");
|
|
1221
|
+
}
|
|
1222
|
+
function He() {
|
|
1223
|
+
return /* @__PURE__ */ i(
|
|
1224
|
+
"svg",
|
|
1225
|
+
{
|
|
1226
|
+
className: "bew-tb-chevron",
|
|
1227
|
+
width: "10",
|
|
1228
|
+
height: "10",
|
|
1229
|
+
viewBox: "0 0 10 10",
|
|
1230
|
+
"aria-hidden": "true",
|
|
1231
|
+
children: /* @__PURE__ */ i(
|
|
1232
|
+
"path",
|
|
1233
|
+
{
|
|
1234
|
+
d: "M2 3.5L5 6.5L8 3.5",
|
|
1235
|
+
fill: "none",
|
|
1236
|
+
stroke: "currentColor",
|
|
1237
|
+
strokeWidth: "1.4",
|
|
1238
|
+
strokeLinecap: "round",
|
|
1239
|
+
strokeLinejoin: "round"
|
|
1240
|
+
}
|
|
1241
|
+
)
|
|
1242
|
+
}
|
|
1243
|
+
);
|
|
1244
|
+
}
|
|
1245
|
+
const Fe = {
|
|
1246
|
+
left: [
|
|
1247
|
+
[1, 15],
|
|
1248
|
+
[1, 9],
|
|
1249
|
+
[1, 15],
|
|
1250
|
+
[1, 9]
|
|
1251
|
+
],
|
|
1252
|
+
center: [
|
|
1253
|
+
[1, 15],
|
|
1254
|
+
[4, 12],
|
|
1255
|
+
[1, 15],
|
|
1256
|
+
[4, 12]
|
|
1257
|
+
],
|
|
1258
|
+
right: [
|
|
1259
|
+
[1, 15],
|
|
1260
|
+
[7, 15],
|
|
1261
|
+
[1, 15],
|
|
1262
|
+
[7, 15]
|
|
1263
|
+
],
|
|
1264
|
+
justify: [
|
|
1265
|
+
[1, 15],
|
|
1266
|
+
[1, 15],
|
|
1267
|
+
[1, 15],
|
|
1268
|
+
[1, 15]
|
|
1269
|
+
]
|
|
1270
|
+
};
|
|
1271
|
+
function Re({ align: e }) {
|
|
1272
|
+
return /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: Fe[e].map(([n, t], r) => /* @__PURE__ */ i(
|
|
1273
|
+
"line",
|
|
1274
|
+
{
|
|
1275
|
+
x1: n,
|
|
1276
|
+
x2: t,
|
|
1277
|
+
y1: 3 + r * 3.5,
|
|
1278
|
+
y2: 3 + r * 3.5,
|
|
1279
|
+
stroke: "currentColor",
|
|
1280
|
+
strokeWidth: "1.4",
|
|
1281
|
+
strokeLinecap: "round"
|
|
1282
|
+
},
|
|
1283
|
+
r
|
|
1284
|
+
)) });
|
|
1285
|
+
}
|
|
1286
|
+
const je = ["left", "center", "right", "justify"];
|
|
1287
|
+
function P({
|
|
1288
|
+
label: e,
|
|
1289
|
+
ariaLabel: n,
|
|
1290
|
+
children: t,
|
|
1291
|
+
triggerClassName: r,
|
|
1292
|
+
menuClassName: o
|
|
1293
|
+
}) {
|
|
1294
|
+
const [s, l] = C(!1), c = V(null);
|
|
1295
|
+
return L(() => {
|
|
1296
|
+
if (!s) return;
|
|
1297
|
+
const a = (d) => {
|
|
1298
|
+
c.current && !c.current.contains(d.target) && l(!1);
|
|
1299
|
+
};
|
|
1300
|
+
return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
|
|
1301
|
+
}, [s]), /* @__PURE__ */ b("div", { className: "bew-tb-dropdown", ref: c, children: [
|
|
1302
|
+
/* @__PURE__ */ b(
|
|
1303
|
+
"button",
|
|
1304
|
+
{
|
|
1305
|
+
type: "button",
|
|
1306
|
+
className: r ?? "bew-tb-dropdown-trigger",
|
|
1307
|
+
"aria-label": n,
|
|
1308
|
+
"aria-expanded": s,
|
|
1309
|
+
onClick: () => l((a) => !a),
|
|
1310
|
+
children: [
|
|
1311
|
+
r ? e : /* @__PURE__ */ i("span", { className: "bew-tb-dropdown-label", children: e }),
|
|
1312
|
+
!r && /* @__PURE__ */ i(He, {})
|
|
1313
|
+
]
|
|
1314
|
+
}
|
|
1315
|
+
),
|
|
1316
|
+
s && /* @__PURE__ */ i(
|
|
1317
|
+
"div",
|
|
1318
|
+
{
|
|
1319
|
+
className: `bew-tb-menu${o ? ` ${o}` : ""}`,
|
|
1320
|
+
onClick: () => l(!1),
|
|
1321
|
+
children: t
|
|
1322
|
+
}
|
|
1323
|
+
)
|
|
1324
|
+
] });
|
|
1325
|
+
}
|
|
1326
|
+
function Ke() {
|
|
1327
|
+
return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1328
|
+
/* @__PURE__ */ i(
|
|
1329
|
+
"path",
|
|
1330
|
+
{
|
|
1331
|
+
d: "M3.5 12L6.5 4h1L10.5 12M4.6 9.2h4.3",
|
|
1332
|
+
fill: "none",
|
|
1333
|
+
stroke: "currentColor",
|
|
1334
|
+
strokeWidth: "1.3",
|
|
1335
|
+
strokeLinecap: "round",
|
|
1336
|
+
strokeLinejoin: "round"
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
/* @__PURE__ */ i("rect", { x: "2.5", y: "13", width: "9", height: "2", rx: "0.5", className: "bew-tb-colorbar" })
|
|
1340
|
+
] });
|
|
1341
|
+
}
|
|
1342
|
+
function Pe() {
|
|
1343
|
+
return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1344
|
+
/* @__PURE__ */ i(
|
|
1345
|
+
"path",
|
|
1346
|
+
{
|
|
1347
|
+
d: "M6 2.5l5 5-4.2 4.2a1.5 1.5 0 0 1-2.1 0L2.5 9.5a1.5 1.5 0 0 1 0-2.1z",
|
|
1348
|
+
fill: "none",
|
|
1349
|
+
stroke: "currentColor",
|
|
1350
|
+
strokeWidth: "1.2",
|
|
1351
|
+
strokeLinejoin: "round"
|
|
1352
|
+
}
|
|
1353
|
+
),
|
|
1354
|
+
/* @__PURE__ */ i("path", { d: "M4 8.5h7", fill: "none", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
1355
|
+
/* @__PURE__ */ i("rect", { x: "2.5", y: "13", width: "11", height: "2", rx: "0.5", className: "bew-tb-colorbar" })
|
|
1356
|
+
] });
|
|
1357
|
+
}
|
|
1358
|
+
function Je() {
|
|
1359
|
+
return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1360
|
+
/* @__PURE__ */ i(
|
|
1361
|
+
"rect",
|
|
1362
|
+
{
|
|
1363
|
+
x: "2.5",
|
|
1364
|
+
y: "2.5",
|
|
1365
|
+
width: "8",
|
|
1366
|
+
height: "8",
|
|
1367
|
+
rx: "1",
|
|
1368
|
+
fill: "none",
|
|
1369
|
+
stroke: "currentColor",
|
|
1370
|
+
strokeWidth: "1.3",
|
|
1371
|
+
strokeDasharray: "2 1.4"
|
|
1372
|
+
}
|
|
1373
|
+
),
|
|
1374
|
+
/* @__PURE__ */ i("rect", { x: "2.5", y: "13", width: "11", height: "2", rx: "0.5", className: "bew-tb-colorbar" })
|
|
1375
|
+
] });
|
|
1376
|
+
}
|
|
1377
|
+
function Ue() {
|
|
1378
|
+
return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1379
|
+
/* @__PURE__ */ i(
|
|
1380
|
+
"rect",
|
|
1381
|
+
{
|
|
1382
|
+
x: "1.5",
|
|
1383
|
+
y: "2.5",
|
|
1384
|
+
width: "13",
|
|
1385
|
+
height: "11",
|
|
1386
|
+
rx: "1.5",
|
|
1387
|
+
fill: "none",
|
|
1388
|
+
stroke: "currentColor",
|
|
1389
|
+
strokeWidth: "1.2"
|
|
1390
|
+
}
|
|
1391
|
+
),
|
|
1392
|
+
/* @__PURE__ */ i("circle", { cx: "5.5", cy: "6", r: "1.3", fill: "currentColor" }),
|
|
1393
|
+
/* @__PURE__ */ i(
|
|
1394
|
+
"path",
|
|
1395
|
+
{
|
|
1396
|
+
d: "M2.5 12l3.5-4 2.5 2.5L11 8l3 3.5",
|
|
1397
|
+
fill: "none",
|
|
1398
|
+
stroke: "currentColor",
|
|
1399
|
+
strokeWidth: "1.2",
|
|
1400
|
+
strokeLinejoin: "round"
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
] });
|
|
1404
|
+
}
|
|
1405
|
+
function Ge() {
|
|
1406
|
+
return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1407
|
+
/* @__PURE__ */ i("line", { x1: "2", y1: "8", x2: "14", y2: "8", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }),
|
|
1408
|
+
/* @__PURE__ */ i("line", { x1: "3.5", y1: "4.5", x2: "12.5", y2: "4.5", stroke: "currentColor", strokeWidth: "1.1", strokeLinecap: "round", opacity: "0.35" }),
|
|
1409
|
+
/* @__PURE__ */ i("line", { x1: "3.5", y1: "11.5", x2: "12.5", y2: "11.5", stroke: "currentColor", strokeWidth: "1.1", strokeLinecap: "round", opacity: "0.35" })
|
|
1410
|
+
] });
|
|
1411
|
+
}
|
|
1412
|
+
function Ve() {
|
|
1413
|
+
return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1414
|
+
/* @__PURE__ */ i(
|
|
1415
|
+
"rect",
|
|
1416
|
+
{
|
|
1417
|
+
x: "1.5",
|
|
1418
|
+
y: "4.5",
|
|
1419
|
+
width: "13",
|
|
1420
|
+
height: "7",
|
|
1421
|
+
rx: "2",
|
|
1422
|
+
fill: "currentColor",
|
|
1423
|
+
opacity: "0.15"
|
|
1424
|
+
}
|
|
1425
|
+
),
|
|
1426
|
+
/* @__PURE__ */ i(
|
|
1427
|
+
"rect",
|
|
1428
|
+
{
|
|
1429
|
+
x: "1.5",
|
|
1430
|
+
y: "4.5",
|
|
1431
|
+
width: "13",
|
|
1432
|
+
height: "7",
|
|
1433
|
+
rx: "2",
|
|
1434
|
+
fill: "none",
|
|
1435
|
+
stroke: "currentColor",
|
|
1436
|
+
strokeWidth: "1.2"
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
/* @__PURE__ */ i("path", { d: "M5.5 8h5M8 5.5v5", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
|
|
1440
|
+
] });
|
|
1441
|
+
}
|
|
1442
|
+
function Xe() {
|
|
1443
|
+
const [e] = E(), [n, t] = C({
|
|
1444
|
+
bold: !1,
|
|
1445
|
+
italic: !1,
|
|
1446
|
+
underline: !1,
|
|
1447
|
+
strikethrough: !1
|
|
1448
|
+
}), [r, o] = C("left"), [s, l] = C(!1), [c, a] = C(!1), d = _(() => {
|
|
1449
|
+
const u = D();
|
|
1450
|
+
if (!W(u)) return;
|
|
1451
|
+
t({
|
|
1452
|
+
bold: u.hasFormat("bold"),
|
|
1453
|
+
italic: u.hasFormat("italic"),
|
|
1454
|
+
underline: u.hasFormat("underline"),
|
|
1455
|
+
strikethrough: u.hasFormat("strikethrough")
|
|
1456
|
+
});
|
|
1457
|
+
const y = u.anchor.getNode(), st = y.getKey() === "root" ? y : y.getTopLevelElementOrThrow();
|
|
1458
|
+
o(
|
|
1459
|
+
Jt(st) ? nt(st.getFormatType()) ?? "left" : "left"
|
|
1460
|
+
);
|
|
1461
|
+
}, []);
|
|
1462
|
+
L(() => te(
|
|
1463
|
+
e.registerUpdateListener(({ editorState: u }) => {
|
|
1464
|
+
u.read(d);
|
|
1465
|
+
}),
|
|
1466
|
+
e.registerCommand(
|
|
1467
|
+
Ut,
|
|
1468
|
+
() => (d(), !1),
|
|
1469
|
+
H
|
|
1470
|
+
),
|
|
1471
|
+
e.registerCommand(
|
|
1472
|
+
Gt,
|
|
1473
|
+
(u) => (l(u), !1),
|
|
1474
|
+
H
|
|
1475
|
+
),
|
|
1476
|
+
e.registerCommand(
|
|
1477
|
+
Vt,
|
|
1478
|
+
(u) => (a(u), !1),
|
|
1479
|
+
H
|
|
1480
|
+
)
|
|
1481
|
+
), [e, d]);
|
|
1482
|
+
const g = _(
|
|
1483
|
+
(u) => {
|
|
1484
|
+
Be(e, u);
|
|
1485
|
+
},
|
|
1486
|
+
[e]
|
|
1487
|
+
), f = _(
|
|
1488
|
+
(u) => {
|
|
1489
|
+
e.dispatchCommand(Xt, u);
|
|
1490
|
+
},
|
|
1491
|
+
[e]
|
|
1492
|
+
), h = _(
|
|
1493
|
+
(u) => {
|
|
1494
|
+
e.dispatchCommand(Yt, u);
|
|
1495
|
+
},
|
|
1496
|
+
[e]
|
|
1497
|
+
), m = _(
|
|
1498
|
+
(u, y) => {
|
|
1499
|
+
Ae(e, u, y);
|
|
1500
|
+
},
|
|
1501
|
+
[e]
|
|
1502
|
+
), Et = _(() => {
|
|
1503
|
+
ke(e, { ...$e(), label: "Button" });
|
|
1504
|
+
}, [e]), Tt = _(() => {
|
|
1505
|
+
const u = window.prompt("Image URL"), y = u == null ? void 0 : u.trim();
|
|
1506
|
+
y && Ne(e, { src: y });
|
|
1507
|
+
}, [e]), Ot = _(() => {
|
|
1508
|
+
Se(e);
|
|
1509
|
+
}, [e]);
|
|
1510
|
+
return /* @__PURE__ */ b("div", { className: "bew-toolbar", role: "toolbar", "aria-label": "Formatting", children: [
|
|
1511
|
+
/* @__PURE__ */ i(
|
|
1512
|
+
"button",
|
|
1513
|
+
{
|
|
1514
|
+
type: "button",
|
|
1515
|
+
className: "bew-tb-btn",
|
|
1516
|
+
"aria-label": "Undo",
|
|
1517
|
+
disabled: !s,
|
|
1518
|
+
onClick: () => e.dispatchCommand(Zt, void 0),
|
|
1519
|
+
children: "↶"
|
|
1520
|
+
}
|
|
1521
|
+
),
|
|
1522
|
+
/* @__PURE__ */ i(
|
|
1523
|
+
"button",
|
|
1524
|
+
{
|
|
1525
|
+
type: "button",
|
|
1526
|
+
className: "bew-tb-btn",
|
|
1527
|
+
"aria-label": "Redo",
|
|
1528
|
+
disabled: !c,
|
|
1529
|
+
onClick: () => e.dispatchCommand(qt, void 0),
|
|
1530
|
+
children: "↷"
|
|
1531
|
+
}
|
|
1532
|
+
),
|
|
1533
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-divider" }),
|
|
1534
|
+
/* @__PURE__ */ b(
|
|
1535
|
+
"button",
|
|
1536
|
+
{
|
|
1537
|
+
type: "button",
|
|
1538
|
+
className: "bew-tb-btn bew-tb-font",
|
|
1539
|
+
"aria-label": "Decrease font size",
|
|
1540
|
+
title: "Decrease font size",
|
|
1541
|
+
onClick: () => g("decrease"),
|
|
1542
|
+
children: [
|
|
1543
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-font-a bew-tb-font-a--sm", children: "A" }),
|
|
1544
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-font-sign", children: "−" })
|
|
1545
|
+
]
|
|
1546
|
+
}
|
|
1547
|
+
),
|
|
1548
|
+
/* @__PURE__ */ b(
|
|
1549
|
+
"button",
|
|
1550
|
+
{
|
|
1551
|
+
type: "button",
|
|
1552
|
+
className: "bew-tb-btn bew-tb-font",
|
|
1553
|
+
"aria-label": "Increase font size",
|
|
1554
|
+
title: "Increase font size",
|
|
1555
|
+
onClick: () => g("increase"),
|
|
1556
|
+
children: [
|
|
1557
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-font-a bew-tb-font-a--lg", children: "A" }),
|
|
1558
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-font-sign", children: "+" })
|
|
1559
|
+
]
|
|
1560
|
+
}
|
|
1561
|
+
),
|
|
1562
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-divider" }),
|
|
1563
|
+
/* @__PURE__ */ i(
|
|
1564
|
+
"button",
|
|
1565
|
+
{
|
|
1566
|
+
type: "button",
|
|
1567
|
+
className: S("bew-tb-btn", "bew-tb-btn--bold", n.bold && "is-active"),
|
|
1568
|
+
"aria-label": "Bold",
|
|
1569
|
+
"aria-pressed": n.bold,
|
|
1570
|
+
onClick: () => f("bold"),
|
|
1571
|
+
children: "B"
|
|
1572
|
+
}
|
|
1573
|
+
),
|
|
1574
|
+
/* @__PURE__ */ i(
|
|
1575
|
+
"button",
|
|
1576
|
+
{
|
|
1577
|
+
type: "button",
|
|
1578
|
+
className: S("bew-tb-btn", "bew-tb-btn--italic", n.italic && "is-active"),
|
|
1579
|
+
"aria-label": "Italic",
|
|
1580
|
+
"aria-pressed": n.italic,
|
|
1581
|
+
onClick: () => f("italic"),
|
|
1582
|
+
children: "I"
|
|
1583
|
+
}
|
|
1584
|
+
),
|
|
1585
|
+
/* @__PURE__ */ i(
|
|
1586
|
+
"button",
|
|
1587
|
+
{
|
|
1588
|
+
type: "button",
|
|
1589
|
+
className: S(
|
|
1590
|
+
"bew-tb-btn",
|
|
1591
|
+
"bew-tb-btn--underline",
|
|
1592
|
+
n.underline && "is-active"
|
|
1593
|
+
),
|
|
1594
|
+
"aria-label": "Underline",
|
|
1595
|
+
"aria-pressed": n.underline,
|
|
1596
|
+
onClick: () => f("underline"),
|
|
1597
|
+
children: "U"
|
|
1598
|
+
}
|
|
1599
|
+
),
|
|
1600
|
+
/* @__PURE__ */ i(
|
|
1601
|
+
"button",
|
|
1602
|
+
{
|
|
1603
|
+
type: "button",
|
|
1604
|
+
className: S(
|
|
1605
|
+
"bew-tb-btn",
|
|
1606
|
+
"bew-tb-btn--strike",
|
|
1607
|
+
n.strikethrough && "is-active"
|
|
1608
|
+
),
|
|
1609
|
+
"aria-label": "Strikethrough",
|
|
1610
|
+
"aria-pressed": n.strikethrough,
|
|
1611
|
+
onClick: () => f("strikethrough"),
|
|
1612
|
+
children: "S"
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1615
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-divider" }),
|
|
1616
|
+
je.map((u) => /* @__PURE__ */ i(
|
|
1617
|
+
"button",
|
|
1618
|
+
{
|
|
1619
|
+
type: "button",
|
|
1620
|
+
className: S("bew-tb-btn", r === u && "is-active"),
|
|
1621
|
+
"aria-label": `Align ${u}`,
|
|
1622
|
+
"aria-pressed": r === u,
|
|
1623
|
+
onClick: () => h(u),
|
|
1624
|
+
children: /* @__PURE__ */ i(Re, { align: u })
|
|
1625
|
+
},
|
|
1626
|
+
u
|
|
1627
|
+
)),
|
|
1628
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-divider" }),
|
|
1629
|
+
/* @__PURE__ */ i(
|
|
1630
|
+
P,
|
|
1631
|
+
{
|
|
1632
|
+
ariaLabel: "Text color",
|
|
1633
|
+
triggerClassName: "bew-tb-btn",
|
|
1634
|
+
menuClassName: "bew-tb-menu--color",
|
|
1635
|
+
label: /* @__PURE__ */ i(Ke, {}),
|
|
1636
|
+
children: /* @__PURE__ */ i(K, { onSelect: (u) => m("text", u) })
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
/* @__PURE__ */ i(
|
|
1640
|
+
P,
|
|
1641
|
+
{
|
|
1642
|
+
ariaLabel: "Background color",
|
|
1643
|
+
triggerClassName: "bew-tb-btn",
|
|
1644
|
+
menuClassName: "bew-tb-menu--color",
|
|
1645
|
+
label: /* @__PURE__ */ i(Pe, {}),
|
|
1646
|
+
children: /* @__PURE__ */ i(K, { onSelect: (u) => m("bg", u) })
|
|
1647
|
+
}
|
|
1648
|
+
),
|
|
1649
|
+
/* @__PURE__ */ i(
|
|
1650
|
+
P,
|
|
1651
|
+
{
|
|
1652
|
+
ariaLabel: "Border color (buttons)",
|
|
1653
|
+
triggerClassName: "bew-tb-btn",
|
|
1654
|
+
menuClassName: "bew-tb-menu--color",
|
|
1655
|
+
label: /* @__PURE__ */ i(Je, {}),
|
|
1656
|
+
children: /* @__PURE__ */ i(K, { onSelect: (u) => m("border", u) })
|
|
1657
|
+
}
|
|
1658
|
+
),
|
|
1659
|
+
/* @__PURE__ */ i("span", { className: "bew-tb-divider" }),
|
|
1660
|
+
/* @__PURE__ */ i(
|
|
1661
|
+
"button",
|
|
1662
|
+
{
|
|
1663
|
+
type: "button",
|
|
1664
|
+
className: "bew-tb-btn",
|
|
1665
|
+
"aria-label": "Insert button",
|
|
1666
|
+
title: "Insert button",
|
|
1667
|
+
onClick: Et,
|
|
1668
|
+
children: /* @__PURE__ */ i(Ve, {})
|
|
1669
|
+
}
|
|
1670
|
+
),
|
|
1671
|
+
/* @__PURE__ */ i(
|
|
1672
|
+
"button",
|
|
1673
|
+
{
|
|
1674
|
+
type: "button",
|
|
1675
|
+
className: "bew-tb-btn",
|
|
1676
|
+
"aria-label": "Insert image",
|
|
1677
|
+
title: "Insert image from URL",
|
|
1678
|
+
onClick: Tt,
|
|
1679
|
+
children: /* @__PURE__ */ i(Ue, {})
|
|
1680
|
+
}
|
|
1681
|
+
),
|
|
1682
|
+
/* @__PURE__ */ i(
|
|
1683
|
+
"button",
|
|
1684
|
+
{
|
|
1685
|
+
type: "button",
|
|
1686
|
+
className: "bew-tb-btn",
|
|
1687
|
+
"aria-label": "Insert separator",
|
|
1688
|
+
title: "Insert separator",
|
|
1689
|
+
onClick: Ot,
|
|
1690
|
+
children: /* @__PURE__ */ i(Ge, {})
|
|
1691
|
+
}
|
|
1692
|
+
)
|
|
1693
|
+
] });
|
|
1694
|
+
}
|
|
1695
|
+
const Ye = /* @__PURE__ */ new Set([
|
|
1696
|
+
"DIV",
|
|
1697
|
+
"P",
|
|
1698
|
+
"H1",
|
|
1699
|
+
"H2",
|
|
1700
|
+
"H3",
|
|
1701
|
+
"H4",
|
|
1702
|
+
"H5",
|
|
1703
|
+
"H6",
|
|
1704
|
+
"TABLE",
|
|
1705
|
+
"THEAD",
|
|
1706
|
+
"TBODY",
|
|
1707
|
+
"TR",
|
|
1708
|
+
"TD",
|
|
1709
|
+
"TH",
|
|
1710
|
+
"UL",
|
|
1711
|
+
"OL",
|
|
1712
|
+
"LI"
|
|
1713
|
+
]), St = /* @__PURE__ */ new Set(["BR", "HR", "IMG"]);
|
|
1714
|
+
function $(e) {
|
|
1715
|
+
return Array.from(e.attributes).map((n) => ` ${n.name}="${n.value}"`).join("");
|
|
1716
|
+
}
|
|
1717
|
+
function Ze(e) {
|
|
1718
|
+
const n = e.trim().toLowerCase(), t = n.match(/^rgba?\(([^)]+)\)$/);
|
|
1719
|
+
if (!t) return n;
|
|
1720
|
+
const [r, o, s] = t[1].split(",").map((c) => c.trim()), l = (c) => Math.max(0, Math.min(255, parseInt(c, 10))).toString(16).padStart(2, "0");
|
|
1721
|
+
return `#${l(r)}${l(o)}${l(s)}`;
|
|
1722
|
+
}
|
|
1723
|
+
function qe(e) {
|
|
1724
|
+
e.querySelectorAll("[style]").forEach((n) => {
|
|
1725
|
+
const t = n.tagName === "A" && n.classList.contains("btn"), r = (n.getAttribute("style") ?? "").split(";").map((s) => s.trim()).filter(Boolean), o = [];
|
|
1726
|
+
for (const s of r) {
|
|
1727
|
+
const [l, ...c] = s.split(":"), a = l.trim().toLowerCase(), d = c.join(":").trim(), g = a === "color" ? "text" : a === "background-color" ? "bg" : a === "border-color" ? "border" : null;
|
|
1728
|
+
if (g) {
|
|
1729
|
+
const f = Ze(d), h = ie(f), m = h ? I(h, g) : null;
|
|
1730
|
+
m ? n.classList.add(m) : o.push(`${a}: ${f}`);
|
|
1731
|
+
continue;
|
|
1732
|
+
}
|
|
1733
|
+
if (a === "font-size" && !t) {
|
|
1734
|
+
const f = _t(xt(parseInt(d, 10)));
|
|
1735
|
+
if (f) {
|
|
1736
|
+
n.classList.add(f);
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
o.push(s);
|
|
1741
|
+
}
|
|
1742
|
+
o.length ? n.setAttribute("style", o.join("; ")) : n.removeAttribute("style");
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
function Qe(e) {
|
|
1746
|
+
e.querySelectorAll("span").forEach((n) => {
|
|
1747
|
+
const t = n.getAttribute("style") ?? "";
|
|
1748
|
+
if (t.includes("white-space")) {
|
|
1749
|
+
const r = t.split(";").map((o) => o.trim()).filter((o) => o && !o.toLowerCase().startsWith("white-space")).join("; ");
|
|
1750
|
+
r ? n.setAttribute("style", r) : n.removeAttribute("style");
|
|
1751
|
+
}
|
|
1752
|
+
n.attributes.length === 0 && n.replaceWith(...Array.from(n.childNodes));
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
function vt(e) {
|
|
1756
|
+
if (e.nodeType === Node.TEXT_NODE) return e.textContent ?? "";
|
|
1757
|
+
if (e.nodeType !== Node.ELEMENT_NODE) return "";
|
|
1758
|
+
const n = e, t = n.tagName.toLowerCase();
|
|
1759
|
+
if (St.has(n.tagName)) return `<${t}${$(n)}>`;
|
|
1760
|
+
const r = Array.from(n.childNodes).map(vt).join("");
|
|
1761
|
+
return `<${t}${$(n)}>${r}</${t}>`;
|
|
1762
|
+
}
|
|
1763
|
+
function $t(e, n) {
|
|
1764
|
+
const t = " ".repeat(n);
|
|
1765
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
1766
|
+
const a = e.textContent ?? "";
|
|
1767
|
+
return a.trim() ? `${t}${a.trim()}` : "";
|
|
1768
|
+
}
|
|
1769
|
+
if (e.nodeType !== Node.ELEMENT_NODE) return "";
|
|
1770
|
+
const r = e, o = r.tagName.toLowerCase();
|
|
1771
|
+
if (St.has(r.tagName)) return `${t}<${o}${$(r)}>`;
|
|
1772
|
+
const s = Array.from(r.childNodes);
|
|
1773
|
+
if (!s.some(
|
|
1774
|
+
(a) => a.nodeType === Node.ELEMENT_NODE && Ye.has(a.tagName)
|
|
1775
|
+
)) {
|
|
1776
|
+
const a = s.map(vt).join("");
|
|
1777
|
+
return `${t}<${o}${$(r)}>${a}</${o}>`;
|
|
1778
|
+
}
|
|
1779
|
+
const c = s.map((a) => $t(a, n + 1)).filter(Boolean).join(`
|
|
1780
|
+
`);
|
|
1781
|
+
return `${t}<${o}${$(r)}>
|
|
1782
|
+
${c}
|
|
1783
|
+
${t}</${o}>`;
|
|
1784
|
+
}
|
|
1785
|
+
function tr(e, n = !0) {
|
|
1786
|
+
const t = document.createElement("div");
|
|
1787
|
+
return t.innerHTML = e, qe(t), Qe(t), n ? Array.from(t.childNodes).map((r) => $t(r, 0)).filter(Boolean).join(`
|
|
1788
|
+
`) : t.innerHTML;
|
|
1789
|
+
}
|
|
1790
|
+
function er(e, n) {
|
|
1791
|
+
return `<!DOCTYPE html>
|
|
1792
|
+
<html>
|
|
1793
|
+
<head>
|
|
1794
|
+
<meta charset="utf-8">
|
|
1795
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1796
|
+
</head>
|
|
1797
|
+
<body>
|
|
1798
|
+
<div class="container">
|
|
1799
|
+
${n ? e.split(`
|
|
1800
|
+
`).map((r) => ` ${r}`).join(`
|
|
1801
|
+
`) : e}
|
|
1802
|
+
</div>
|
|
1803
|
+
</body>
|
|
1804
|
+
</html>`;
|
|
1805
|
+
}
|
|
1806
|
+
function Lt(e, n = {}) {
|
|
1807
|
+
const { document: t = !1, pretty: r = !0 } = n;
|
|
1808
|
+
let o = "";
|
|
1809
|
+
e.getEditorState().read(() => {
|
|
1810
|
+
o = re(e, null);
|
|
1811
|
+
});
|
|
1812
|
+
const s = tr(o, r);
|
|
1813
|
+
return t ? er(s, r) : s;
|
|
1814
|
+
}
|
|
1815
|
+
function rr({
|
|
1816
|
+
editorRef: e
|
|
1817
|
+
}) {
|
|
1818
|
+
const [n] = E();
|
|
1819
|
+
return L(() => (e.current = n, () => {
|
|
1820
|
+
e.current = null;
|
|
1821
|
+
}), [n, e]), null;
|
|
1822
|
+
}
|
|
1823
|
+
function nr({
|
|
1824
|
+
onChange: e
|
|
1825
|
+
}) {
|
|
1826
|
+
const [n] = E();
|
|
1827
|
+
return L(() => n.registerUpdateListener(({ editorState: t }) => {
|
|
1828
|
+
e({
|
|
1829
|
+
html: Lt(n),
|
|
1830
|
+
json: JSON.stringify(t.toJSON())
|
|
1831
|
+
});
|
|
1832
|
+
}), [n, e]), null;
|
|
1833
|
+
}
|
|
1834
|
+
const _r = Bt(function({
|
|
1835
|
+
placeholder: n = "Start writing your email…",
|
|
1836
|
+
toolbar: t = !0,
|
|
1837
|
+
initialContent: r,
|
|
1838
|
+
onChange: o,
|
|
1839
|
+
onError: s,
|
|
1840
|
+
children: l
|
|
1841
|
+
}, c) {
|
|
1842
|
+
const a = V(null);
|
|
1843
|
+
Dt(
|
|
1844
|
+
c,
|
|
1845
|
+
() => ({
|
|
1846
|
+
getHtml: (f) => a.current ? Lt(a.current, f) : "",
|
|
1847
|
+
getJson: () => a.current ? JSON.stringify(a.current.getEditorState().toJSON()) : "",
|
|
1848
|
+
focus: () => {
|
|
1849
|
+
var f;
|
|
1850
|
+
return (f = a.current) == null ? void 0 : f.focus();
|
|
1851
|
+
},
|
|
1852
|
+
clear: () => {
|
|
1853
|
+
var f;
|
|
1854
|
+
return (f = a.current) == null ? void 0 : f.update(() => {
|
|
1855
|
+
Qt().clear();
|
|
1856
|
+
});
|
|
1857
|
+
},
|
|
1858
|
+
getEditor: () => a.current
|
|
1859
|
+
}),
|
|
1860
|
+
[]
|
|
1861
|
+
);
|
|
1862
|
+
const d = _(
|
|
1863
|
+
(f) => {
|
|
1864
|
+
if (s) s(f);
|
|
1865
|
+
else throw f;
|
|
1866
|
+
},
|
|
1867
|
+
[s]
|
|
1868
|
+
);
|
|
1869
|
+
return /* @__PURE__ */ b(Wt, { initialConfig: {
|
|
1870
|
+
namespace: "bootstrap-email-wysiwyg",
|
|
1871
|
+
theme: ne,
|
|
1872
|
+
editorState: r,
|
|
1873
|
+
nodes: [
|
|
1874
|
+
T,
|
|
1875
|
+
O,
|
|
1876
|
+
A,
|
|
1877
|
+
N,
|
|
1878
|
+
// Swap the core paragraph for our Bootstrap Email `<div>` variant.
|
|
1879
|
+
{
|
|
1880
|
+
replace: ct,
|
|
1881
|
+
with: () => new N(),
|
|
1882
|
+
withKlass: N
|
|
1883
|
+
}
|
|
1884
|
+
],
|
|
1885
|
+
onError: d
|
|
1886
|
+
}, children: [
|
|
1887
|
+
/* @__PURE__ */ b("div", { className: "bew-editor-shell", children: [
|
|
1888
|
+
t && /* @__PURE__ */ i(Xe, {}),
|
|
1889
|
+
/* @__PURE__ */ i("div", { className: "bew-editor-body", children: /* @__PURE__ */ i(
|
|
1890
|
+
zt,
|
|
1891
|
+
{
|
|
1892
|
+
contentEditable: /* @__PURE__ */ i(Ht, { className: "bew-content-editable" }),
|
|
1893
|
+
placeholder: /* @__PURE__ */ i("div", { className: "bew-placeholder", children: n }),
|
|
1894
|
+
ErrorBoundary: Rt
|
|
1895
|
+
}
|
|
1896
|
+
) }),
|
|
1897
|
+
/* @__PURE__ */ i(Ft, {})
|
|
1898
|
+
] }),
|
|
1899
|
+
/* @__PURE__ */ i(rr, { editorRef: a }),
|
|
1900
|
+
o && /* @__PURE__ */ i(nr, { onChange: o }),
|
|
1901
|
+
l
|
|
1902
|
+
] });
|
|
1903
|
+
});
|
|
1904
|
+
export {
|
|
1905
|
+
Me as $adjustFontSize,
|
|
1906
|
+
Oe as $applyColor,
|
|
1907
|
+
et as $createButtonNode,
|
|
1908
|
+
ae as $createButtonWithLabel,
|
|
1909
|
+
it as $createHrNode,
|
|
1910
|
+
ot as $createImageNode,
|
|
1911
|
+
rt as $isButtonNode,
|
|
1912
|
+
we as $isHrNode,
|
|
1913
|
+
ge as $isImageNode,
|
|
1914
|
+
Y as BASE_COLORS,
|
|
1915
|
+
_r as BootstrapEmailEditor,
|
|
1916
|
+
N as BootstrapParagraphNode,
|
|
1917
|
+
T as ButtonNode,
|
|
1918
|
+
Z as COLOR_FAMILIES,
|
|
1919
|
+
K as ColorPicker,
|
|
1920
|
+
w as DEFAULT_HR_MARGIN,
|
|
1921
|
+
v as FONT_SIZE_KEYS,
|
|
1922
|
+
A as HrNode,
|
|
1923
|
+
O as ImageNode,
|
|
1924
|
+
U as MARGIN_STEPS,
|
|
1925
|
+
J as SIZE_STEPS,
|
|
1926
|
+
Xe as Toolbar,
|
|
1927
|
+
De as addCustomColor,
|
|
1928
|
+
Be as adjustFontSize,
|
|
1929
|
+
Ae as applyColor,
|
|
1930
|
+
ue as axAlignClass,
|
|
1931
|
+
ne as bootstrapEmailTheme,
|
|
1932
|
+
tr as cleanBootstrapHtml,
|
|
1933
|
+
mt as colorAttributes,
|
|
1934
|
+
_t as fontSizeClass,
|
|
1935
|
+
M as fontSizePx,
|
|
1936
|
+
gr as getCustomColors,
|
|
1937
|
+
$e as getLastButtonStyle,
|
|
1938
|
+
ie as hexToToken,
|
|
1939
|
+
_e as hrClasses,
|
|
1940
|
+
he as imageClasses,
|
|
1941
|
+
fe as imagePreviewStyle,
|
|
1942
|
+
ke as insertButton,
|
|
1943
|
+
Se as insertHr,
|
|
1944
|
+
Ne as insertImage,
|
|
1945
|
+
lt as marginKeyToPx,
|
|
1946
|
+
nt as normalizeAlign,
|
|
1947
|
+
xt as pxToFontSizeKey,
|
|
1948
|
+
Ct as rememberButtonStyle,
|
|
1949
|
+
We as removeCustomColor,
|
|
1950
|
+
R as sizeKeyToPx,
|
|
1951
|
+
F as stepFontSize,
|
|
1952
|
+
ce as textAlignClass,
|
|
1953
|
+
Lt as toBootstrapEmailHtml,
|
|
1954
|
+
I as tokenToClass,
|
|
1955
|
+
x as tokenToHex,
|
|
1956
|
+
ze as useCustomColors
|
|
1957
|
+
};
|