@maildeno/editor 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,112 +0,0 @@
1
- import { n as defineComponent, o as computed, q as openBlock, t as createElementBlock, F as Fragment, u as renderList, v as normalizeStyle, w as createVNode, x as unref, y as createCommentVNode, z as defineAsyncComponent } from "./element-C2ZH0Z_i.js";
2
- const _hoisted_1 = {
3
- key: 0,
4
- class: "w-full border border-dashed border-(--md-border) rounded",
5
- style: { "min-height": "10px" }
6
- };
7
- const _sfc_main = /* @__PURE__ */ defineComponent({
8
- __name: "RowPreviewRow",
9
- props: {
10
- row: {},
11
- scale: {},
12
- depth: {}
13
- },
14
- setup(__props) {
15
- const RowPreviewChildren = defineAsyncComponent(
16
- () => import("./RowPreviewChildren-DT0y0lKC.js")
17
- );
18
- const props = __props;
19
- function resolveBackground(item) {
20
- var _a;
21
- const bg = item == null ? void 0 : item.backgroundGradient;
22
- const hasGradient = (bg == null ? void 0 : bg.useGradient) === true && Array.isArray((_a = bg == null ? void 0 : bg.gradient) == null ? void 0 : _a.colors) && bg.gradient.colors.length >= 2;
23
- if (hasGradient) {
24
- const { type, direction, colors } = bg.gradient;
25
- const stops = colors.map((c) => `${c.color} ${c.position}%`).join(", ");
26
- return type === "radial" ? `radial-gradient(circle at center, ${stops})` : `linear-gradient(${direction}, ${stops})`;
27
- }
28
- return (item == null ? void 0 : item.backgroundColor) ?? "transparent";
29
- }
30
- const rowStyle = computed(() => {
31
- var _a, _b, _c, _d, _e, _f, _g, _h;
32
- const r = props.row;
33
- const style = {
34
- display: "flex",
35
- flexDirection: "row",
36
- background: resolveBackground(r),
37
- padding: `${((_a = r.padding) == null ? void 0 : _a.top) ?? 0}px ${((_b = r.padding) == null ? void 0 : _b.right) ?? 0}px ${((_c = r.padding) == null ? void 0 : _c.bottom) ?? 0}px ${((_d = r.padding) == null ? void 0 : _d.left) ?? 0}px`,
38
- alignItems: "stretch",
39
- border: `${((_e = r.border) == null ? void 0 : _e.width) ?? 0}px ${((_f = r.border) == null ? void 0 : _f.style) ?? "solid"} ${((_g = r.border) == null ? void 0 : _g.color) ?? "transparent"}`,
40
- borderRadius: `${((_h = r.border) == null ? void 0 : _h.radius) ?? 0}px`,
41
- gap: `${r.gap ?? 0}px`,
42
- overflow: "hidden"
43
- };
44
- if (r.backgroundImage) {
45
- style.backgroundImage = `url(${r.backgroundImage})`;
46
- style.backgroundSize = r.backgroundSize ?? "cover";
47
- style.backgroundPosition = r.backgroundPosition ?? "center center";
48
- }
49
- return style;
50
- });
51
- function colStyle(col, parentRow) {
52
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
53
- const verticalAlignMap = {
54
- top: "flex-start",
55
- middle: "center",
56
- bottom: "flex-end"
57
- };
58
- const widthPct = col.width ?? 50;
59
- const siblingCount = ((_a = parentRow == null ? void 0 : parentRow.columns) == null ? void 0 : _a.length) || 1;
60
- const gapPx = (parentRow == null ? void 0 : parentRow.gap) ?? 0;
61
- const gapShare = siblingCount > 1 ? gapPx * (siblingCount - 1) / siblingCount : 0;
62
- const widthValue = gapShare > 0 ? `calc(${widthPct}% - ${gapShare}px)` : `${widthPct}%`;
63
- const style = {
64
- flex: `0 0 ${widthValue}`,
65
- width: widthValue,
66
- maxWidth: widthValue,
67
- boxSizing: "border-box",
68
- background: resolveBackground(col),
69
- padding: `${((_b = col.padding) == null ? void 0 : _b.top) ?? 10}px ${((_c = col.padding) == null ? void 0 : _c.right) ?? 10}px ${((_d = col.padding) == null ? void 0 : _d.bottom) ?? 10}px ${((_e = col.padding) == null ? void 0 : _e.left) ?? 10}px`,
70
- border: `${((_f = col.border) == null ? void 0 : _f.width) ?? 0}px ${((_g = col.border) == null ? void 0 : _g.style) ?? "solid"} ${((_h = col.border) == null ? void 0 : _h.color) ?? "transparent"}`,
71
- borderRadius: `${((_i = col.border) == null ? void 0 : _i.radius) ?? 0}px`,
72
- overflow: "hidden",
73
- minWidth: "0",
74
- display: "flex",
75
- flexDirection: "column",
76
- justifyContent: verticalAlignMap[col.verticalAlign] ?? "flex-start"
77
- };
78
- if (col.backgroundImage) {
79
- style.backgroundImage = `url(${col.backgroundImage})`;
80
- style.backgroundSize = col.backgroundSize ?? "cover";
81
- style.backgroundPosition = col.backgroundPosition ?? "center center";
82
- style.minHeight = "14px";
83
- }
84
- return style;
85
- }
86
- return (_ctx, _cache) => {
87
- return (__props.depth ?? 0) < 5 ? (openBlock(), createElementBlock("div", {
88
- key: 0,
89
- style: normalizeStyle(rowStyle.value),
90
- class: "w-full"
91
- }, [
92
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.row.columns ?? [], (col) => {
93
- return openBlock(), createElementBlock("div", {
94
- key: col.id,
95
- style: normalizeStyle(colStyle(col, __props.row)),
96
- class: "overflow-hidden shrink-0"
97
- }, [
98
- createVNode(unref(RowPreviewChildren), {
99
- children: col.children ?? col.components ?? [],
100
- scale: __props.scale,
101
- depth: (__props.depth ?? 0) + 1
102
- }, null, 8, ["children", "scale", "depth"]),
103
- (col.children ?? col.components ?? []).length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1)) : createCommentVNode("", true)
104
- ], 4);
105
- }), 128))
106
- ], 4)) : createCommentVNode("", true);
107
- };
108
- }
109
- });
110
- export {
111
- _sfc_main as default
112
- };