easy-email-pro-theme 1.50.19 → 1.51.1
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/lib/index.js +1054 -81
- package/lib/style.css +190 -0
- package/lib/typings/components/BlockSideBar/LayoutItem/SectionLayout.d.ts +6 -0
- package/lib/typings/components/BlockSideBar/LayoutItem/WrapperLayout.d.ts +6 -0
- package/lib/typings/components/BlockSideBar/LayoutItem/index.d.ts +2 -5
- package/lib/typings/components/ConfigurationPanel/components/AttributeField/BackgroundGradient.d.ts +9 -0
- package/lib/typings/components/ConfigurationPanel/components/AttributeField/BackgroundImage.d.ts +4 -0
- package/lib/typings/components/ConfigurationPanel/components/AttributeField/index.d.ts +3 -0
- package/lib/typings/components/Form/ColorPicker/index.d.ts +2 -1
- package/lib/typings/components/Form/GradientGenerator/index.d.ts +13 -0
- package/lib/typings/components/Form/index.d.ts +1 -0
- package/lib/typings/typings/custom-types.d.ts +16 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -54,7 +54,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
54
54
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
|
-
import { classnames, useEditorActions, useDragNodePath, useStandaloneElementEditing, useEditorProps, useRefState, isDOMElement, useMergeTagsData, useLockState, useEventCallback, useSelectedNodePath, useSelectedNode, useSetSelectedNodePath, useSetHoverNodePath, useUniversalElementEditing, useUniversalElementPath, useStandaloneElementPath, useStandaloneElement, useActiveTab, ActiveTabKeys, toggleFormat, TextFormat, useUniversalElement, isFormatActive, validation, CustomEvent, getDynamicImagePlaceholder, EmailEditorProvider, EmailEditor, useForceUpdate,
|
|
57
|
+
import { classnames, useEditorActions, useDragNodePath, useStandaloneElementEditing, useEditorProps, useRefState, isDOMElement, useMergeTagsData, useLockState, useEventCallback, useSelectedNodePath, useSelectedNode, useSetSelectedNodePath, useSetHoverNodePath, useUniversalElementEditing, useUniversalElementPath, useStandaloneElementPath, useStandaloneElement, useActiveTab, ActiveTabKeys, toggleFormat, TextFormat, useUniversalElement, isFormatActive, validation, CustomEvent, getDynamicImagePlaceholder, EmailEditorProvider, EmailEditor, useEditorState, useForceUpdate, useEqualState, IframeComponent, HtmlStringToReactNodes, useStandaloneElementSaveButton, ExternalComponents, useDragoverDirection } from "easy-email-pro-editor";
|
|
58
58
|
import { useSlate, ReactEditor, useSlateStatic, useSelected } from "slate-react";
|
|
59
59
|
import * as React$2 from "react";
|
|
60
60
|
import React__default, { useRef, useState, useEffect, useCallback, useMemo, createContext, useContext, useLayoutEffect, memo, useReducer, cloneElement, forwardRef, Suspense, Component, createElement } from "react";
|
|
@@ -63,7 +63,7 @@ import { cloneDeep, get, isEqual, set, omit as omit$2, merge as merge$1, debounc
|
|
|
63
63
|
import { Editor, Range, Node, Transforms, Path, Text as Text$2, createEditor } from "slate";
|
|
64
64
|
import { nanoid } from "nanoid";
|
|
65
65
|
import { Form, Input, Modal, Collapse, Space, Empty, Card, Grid, Button as Button$2, Drawer, Switch, Typography as Typography$1, Tabs, Radio, Divider as Divider$2, Alert, Popconfirm, Tooltip, Message, PageHeader, Spin, Layout as Layout$2, Popover, Select as Select$1, Slider, InputNumber, Tag, Link as Link$3, List as List$1, Skeleton, Trigger } from "@arco-design/web-react";
|
|
66
|
-
import { IconPlus, IconDelete, IconEdit, IconLeft, IconCopy, IconUndo, IconRedo, IconMinus, IconEye, IconSubscribeAdd, IconClose, IconCheckCircleFill, IconDragArrow, IconLock, IconUnlock, IconQuestionCircle, IconLink, IconCloud, IconDragDotVertical, IconSend, IconDown } from "@arco-design/web-react/icon";
|
|
66
|
+
import { IconPlus, IconDelete, IconEdit, IconLeft, IconCopy, IconUndo, IconRedo, IconMinus, IconEye, IconSubscribeAdd, IconClose, IconCheckCircleFill, IconDragArrow, IconPalette, IconLock, IconUnlock, IconImage, IconQuestionCircle, IconLink, IconCloud, IconDragDotVertical, IconSend, IconDown } from "@arco-design/web-react/icon";
|
|
67
67
|
import { unstable_batchedUpdates, createPortal } from "react-dom";
|
|
68
68
|
import mjml from "mjml-browser";
|
|
69
69
|
import { HistoryEditor } from "slate-history";
|
|
@@ -677,7 +677,7 @@ const withTheme$1 = (editor) => {
|
|
|
677
677
|
};
|
|
678
678
|
return editor;
|
|
679
679
|
};
|
|
680
|
-
const styleText$g = "[data-slate-hide-cursor=true][data-slate-hover=true] {\n cursor: none;\n}\n[data-slate-hide-cursor=true][data-slate-hover=true]:hover {\n outline: none !important;\n}\n\n[data-slate-hide-cursor=true] [data-slate-hover=true] .element-tools-container {\n opacity: 0;\n}\n\n.element-tools-container {\n position: absolute;\n font-size: 14px;\n left: 0px;\n top: 0px;\n width: 100%;\n height: 100%;\n outline-offset: -2px;\n outline: 2px solid transparent;\n outline-offset: -2px;\n pointer-events: none;\n}\n\n.element-tools {\n pointer-events: auto;\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(0, -100%);\n display: flex;\n align-items: center;\n font-size: 14px !important;\n height: 22px;\n padding: 1px 5px;\n line-height: 22px;\n font-weight: normal !important;\n font-style: normal !important;\n}\n.element-tools .element-tools-item {\n font-size: 12px !important;\n line-height: 20px;\n width: 25px;\n display: flex;\n pointer-events: auto;\n cursor: pointer;\n justify-content: center;\n}\n\n.element-tools-move-handle {\n position: absolute;\n right: 0;\n top: 50%;\n transform: translate(50%, -50%);\n width: 35px;\n height: 35px;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n cursor: grab;\n}\n\n.element-tools-bottom {\n top: 100%;\n transform: translate(0, 0);\n}\n\n.element-drag-button {\n pointer-events: auto;\n position: absolute;\n z-index: 4;\n top: 50%;\n right: 0%;\n color: #fff;\n color: rgb(255, 255, 255);\n height: 28px;\n width: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: translate(50%, -50%);\n border-radius: 50%;\n cursor: grab;\n}\n.element-drag-button .iconfont {\n cursor: grab !important;\n}";
|
|
680
|
+
const styleText$g = "[data-slate-hide-cursor=true][data-slate-hover=true] {\n cursor: none;\n}\n[data-slate-hide-cursor=true][data-slate-hover=true]:hover {\n outline: none !important;\n}\n\n[data-slate-hide-cursor=true] [data-slate-hover=true] .element-tools-container {\n opacity: 0;\n}\n\n.element-tools-container {\n position: absolute;\n font-size: 14px;\n left: 0px;\n top: 0px;\n width: 100%;\n height: 100%;\n outline-offset: -2px;\n outline: 2px solid transparent;\n outline-offset: -2px;\n pointer-events: none;\n}\n\n.element-tools {\n pointer-events: auto;\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(0, -100%);\n display: flex;\n flex-wrap: nowrap;\n white-space: nowrap;\n align-items: center;\n font-size: 14px !important;\n height: 22px;\n padding: 1px 5px;\n line-height: 22px;\n font-weight: normal !important;\n font-style: normal !important;\n}\n.element-tools .element-tools-item {\n font-size: 12px !important;\n line-height: 20px;\n width: 25px;\n display: flex;\n pointer-events: auto;\n cursor: pointer;\n justify-content: center;\n}\n\n.element-tools-move-handle {\n position: absolute;\n right: 0;\n top: 50%;\n transform: translate(50%, -50%);\n width: 35px;\n height: 35px;\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n cursor: grab;\n}\n\n.element-tools-bottom {\n top: 100%;\n transform: translate(0, 0);\n}\n\n.element-drag-button {\n pointer-events: auto;\n position: absolute;\n z-index: 4;\n top: 50%;\n right: 0%;\n color: #fff;\n color: rgb(255, 255, 255);\n height: 28px;\n width: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: translate(50%, -50%);\n border-radius: 50%;\n cursor: grab;\n}\n.element-drag-button .iconfont {\n cursor: grab !important;\n}";
|
|
681
681
|
function IconFont(props) {
|
|
682
682
|
var _a;
|
|
683
683
|
return /* @__PURE__ */ React__default.createElement(
|
|
@@ -2487,7 +2487,7 @@ function BlockItem({
|
|
|
2487
2487
|
));
|
|
2488
2488
|
}
|
|
2489
2489
|
const index$d = "";
|
|
2490
|
-
const
|
|
2490
|
+
const SectionLayout = ({
|
|
2491
2491
|
columns,
|
|
2492
2492
|
title
|
|
2493
2493
|
}) => {
|
|
@@ -2543,6 +2543,99 @@ const ColumnElement = ({ column: column2 }) => {
|
|
|
2543
2543
|
);
|
|
2544
2544
|
}))));
|
|
2545
2545
|
};
|
|
2546
|
+
const WrapperLayout = ({
|
|
2547
|
+
variants,
|
|
2548
|
+
title
|
|
2549
|
+
}) => {
|
|
2550
|
+
return /* @__PURE__ */ React__default.createElement(Collapse.Item, { contentStyle: { padding: 10 }, header: title, name: title }, /* @__PURE__ */ React__default.createElement("div", { className: "LayoutWrapperItemList" }, variants.map((block, index2) => {
|
|
2551
|
+
return /* @__PURE__ */ React__default.createElement("div", { key: index2 }, /* @__PURE__ */ React__default.createElement(
|
|
2552
|
+
"div",
|
|
2553
|
+
{
|
|
2554
|
+
key: index2,
|
|
2555
|
+
style: {
|
|
2556
|
+
marginBottom: index2 === variants.length - 1 ? 0 : 10
|
|
2557
|
+
}
|
|
2558
|
+
},
|
|
2559
|
+
/* @__PURE__ */ React__default.createElement(SectionElement, { sections: block.sections })
|
|
2560
|
+
));
|
|
2561
|
+
})));
|
|
2562
|
+
};
|
|
2563
|
+
const SectionElement = ({
|
|
2564
|
+
sections
|
|
2565
|
+
}) => {
|
|
2566
|
+
const isMultipleSections = sections.length > 1;
|
|
2567
|
+
const element = useMemo(() => {
|
|
2568
|
+
if (isMultipleSections) {
|
|
2569
|
+
const wrapperBlock = BlockManager.getBlockByType(
|
|
2570
|
+
ElementType.STANDARD_WRAPPER
|
|
2571
|
+
);
|
|
2572
|
+
return wrapperBlock.create({
|
|
2573
|
+
attributes: {
|
|
2574
|
+
"background-repeat": "no-repeat"
|
|
2575
|
+
},
|
|
2576
|
+
children: sections.map((section) => ({
|
|
2577
|
+
type: StandardType.STANDARD_SECTION,
|
|
2578
|
+
attributes: {},
|
|
2579
|
+
data: {},
|
|
2580
|
+
children: section.columns.map((column2) => ({
|
|
2581
|
+
type: StandardType.STANDARD_COLUMN,
|
|
2582
|
+
attributes: {
|
|
2583
|
+
width: column2
|
|
2584
|
+
},
|
|
2585
|
+
data: {},
|
|
2586
|
+
children: []
|
|
2587
|
+
}))
|
|
2588
|
+
}))
|
|
2589
|
+
});
|
|
2590
|
+
} else {
|
|
2591
|
+
const sectionBlock = BlockManager.getBlockByType(
|
|
2592
|
+
ElementType.STANDARD_SECTION
|
|
2593
|
+
);
|
|
2594
|
+
return sectionBlock.create({
|
|
2595
|
+
attributes: {},
|
|
2596
|
+
data: {},
|
|
2597
|
+
children: sections[0].columns.map((column2) => ({
|
|
2598
|
+
type: StandardType.STANDARD_COLUMN,
|
|
2599
|
+
attributes: {
|
|
2600
|
+
width: column2
|
|
2601
|
+
},
|
|
2602
|
+
data: {},
|
|
2603
|
+
children: []
|
|
2604
|
+
}))
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
}, [isMultipleSections, sections]);
|
|
2608
|
+
const { dragHandle } = useDragging({
|
|
2609
|
+
element,
|
|
2610
|
+
nodeElement: null,
|
|
2611
|
+
action: "copy",
|
|
2612
|
+
cloneGhost: false
|
|
2613
|
+
});
|
|
2614
|
+
return /* @__PURE__ */ React__default.createElement("div", __spreadValues({ className: classnames$1("LayoutWrapperItem") }, dragHandle), sections.map((section, index2) => {
|
|
2615
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
2616
|
+
"div",
|
|
2617
|
+
{
|
|
2618
|
+
key: index2,
|
|
2619
|
+
style: { paddingTop: isMultipleSections && index2 === 0 ? 10 : 0 }
|
|
2620
|
+
},
|
|
2621
|
+
isMultipleSections && /* @__PURE__ */ React__default.createElement("div", { className: "LayoutWrapperItemRowTitle" }, "Row ", index2 + 1),
|
|
2622
|
+
/* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", { className: "LayoutItemOuter" }, /* @__PURE__ */ React__default.createElement("div", { className: "LayoutItemInner" }, section.columns.map((width, index22) => {
|
|
2623
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
2624
|
+
"div",
|
|
2625
|
+
{
|
|
2626
|
+
className: classnames$1("LayoutItemInnerPart"),
|
|
2627
|
+
key: index22,
|
|
2628
|
+
style: {
|
|
2629
|
+
width,
|
|
2630
|
+
borderRight: index22 === section.columns.length - 1 ? "none" : void 0
|
|
2631
|
+
}
|
|
2632
|
+
},
|
|
2633
|
+
width
|
|
2634
|
+
);
|
|
2635
|
+
}))))
|
|
2636
|
+
);
|
|
2637
|
+
}));
|
|
2638
|
+
};
|
|
2546
2639
|
const index$c = "";
|
|
2547
2640
|
const defaultCategories = [
|
|
2548
2641
|
{
|
|
@@ -2739,7 +2832,7 @@ const DefaultBlockList = () => {
|
|
|
2739
2832
|
id: "BlockSideBar-BlockList"
|
|
2740
2833
|
},
|
|
2741
2834
|
/* @__PURE__ */ React__default.createElement(Collapse, { defaultActiveKey }, categories.map((category2, index2) => {
|
|
2742
|
-
var _a;
|
|
2835
|
+
var _a, _b;
|
|
2743
2836
|
if (category2.displayType === "grid") {
|
|
2744
2837
|
return /* @__PURE__ */ React__default.createElement(
|
|
2745
2838
|
Collapse.Item,
|
|
@@ -2784,7 +2877,7 @@ const DefaultBlockList = () => {
|
|
|
2784
2877
|
defaultActiveKey: [((_a = category2.blocks[0]) == null ? void 0 : _a.title) || ""]
|
|
2785
2878
|
},
|
|
2786
2879
|
category2.blocks.map((item2) => /* @__PURE__ */ React__default.createElement(
|
|
2787
|
-
|
|
2880
|
+
SectionLayout,
|
|
2788
2881
|
{
|
|
2789
2882
|
key: item2.title,
|
|
2790
2883
|
title: item2.title || "",
|
|
@@ -2795,6 +2888,39 @@ const DefaultBlockList = () => {
|
|
|
2795
2888
|
/* @__PURE__ */ React__default.createElement(Space, { direction: "vertical" }, /* @__PURE__ */ React__default.createElement("div", null))
|
|
2796
2889
|
);
|
|
2797
2890
|
}
|
|
2891
|
+
if (category2.displayType === "section" && !universalElementEditing) {
|
|
2892
|
+
if (standaloneElementEditing && initialStandaloneElement && !NodeUtils.isParentCategoryType(
|
|
2893
|
+
ElementType.SECTION,
|
|
2894
|
+
initialStandaloneElement.type
|
|
2895
|
+
)) {
|
|
2896
|
+
return null;
|
|
2897
|
+
}
|
|
2898
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
2899
|
+
Collapse.Item,
|
|
2900
|
+
{
|
|
2901
|
+
key: index2,
|
|
2902
|
+
contentStyle: { padding: "0px 20px" },
|
|
2903
|
+
name: index2.toString(),
|
|
2904
|
+
header: category2.label
|
|
2905
|
+
},
|
|
2906
|
+
/* @__PURE__ */ React__default.createElement(Space, { direction: "vertical" }, /* @__PURE__ */ React__default.createElement("div", null)),
|
|
2907
|
+
/* @__PURE__ */ React__default.createElement(
|
|
2908
|
+
Collapse,
|
|
2909
|
+
{
|
|
2910
|
+
defaultActiveKey: [((_b = category2.blocks[0]) == null ? void 0 : _b.title) || ""]
|
|
2911
|
+
},
|
|
2912
|
+
category2.blocks.map((item2, index22) => /* @__PURE__ */ React__default.createElement(
|
|
2913
|
+
WrapperLayout,
|
|
2914
|
+
{
|
|
2915
|
+
key: index22,
|
|
2916
|
+
title: item2.title || "",
|
|
2917
|
+
variants: item2.variants
|
|
2918
|
+
}
|
|
2919
|
+
))
|
|
2920
|
+
),
|
|
2921
|
+
/* @__PURE__ */ React__default.createElement(Space, { direction: "vertical" }, /* @__PURE__ */ React__default.createElement("div", null))
|
|
2922
|
+
);
|
|
2923
|
+
}
|
|
2798
2924
|
if (category2.displayType === "custom" && !universalElementEditing && !standaloneElementEditing) {
|
|
2799
2925
|
return /* @__PURE__ */ React__default.createElement(
|
|
2800
2926
|
Collapse.Item,
|
|
@@ -2829,16 +2955,26 @@ const BlocksPanel = () => {
|
|
|
2829
2955
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !universalElementEditing && universalElementSetting && /* @__PURE__ */ React__default.createElement("div", { style: { padding: 24 } }, /* @__PURE__ */ React__default.createElement(Button$2.Group, { style: { width: "100%" } }, /* @__PURE__ */ React__default.createElement(
|
|
2830
2956
|
Button$2,
|
|
2831
2957
|
{
|
|
2832
|
-
type:
|
|
2833
|
-
style: {
|
|
2958
|
+
type: "outline",
|
|
2959
|
+
style: {
|
|
2960
|
+
width: "50%",
|
|
2961
|
+
borderColor: tab === "Default" ? void 0 : "#000",
|
|
2962
|
+
color: tab === "Default" ? void 0 : "#000",
|
|
2963
|
+
borderRightColor: tab === "Default" ? void 0 : "transparent"
|
|
2964
|
+
},
|
|
2834
2965
|
onClick: () => setTab("Default")
|
|
2835
2966
|
},
|
|
2836
2967
|
/* @__PURE__ */ React__default.createElement(Space, null, t("Default"))
|
|
2837
2968
|
), /* @__PURE__ */ React__default.createElement(
|
|
2838
2969
|
Button$2,
|
|
2839
2970
|
{
|
|
2840
|
-
type:
|
|
2841
|
-
style: {
|
|
2971
|
+
type: "outline",
|
|
2972
|
+
style: {
|
|
2973
|
+
width: "50%",
|
|
2974
|
+
borderColor: tab !== "Default" ? void 0 : "#000",
|
|
2975
|
+
color: tab !== "Default" ? void 0 : "#000",
|
|
2976
|
+
borderLeftColor: tab !== "Default" ? void 0 : "transparent"
|
|
2977
|
+
},
|
|
2842
2978
|
onClick: () => setTab("Universal")
|
|
2843
2979
|
},
|
|
2844
2980
|
/* @__PURE__ */ React__default.createElement(Space, null, t("Universal"))
|
|
@@ -6964,7 +7100,7 @@ const action = "_action_14paa_43";
|
|
|
6964
7100
|
const itemTitle = "_itemTitle_14paa_60";
|
|
6965
7101
|
const itemCollapse = "_itemCollapse_14paa_66";
|
|
6966
7102
|
const itemChildren = "_itemChildren_14paa_87";
|
|
6967
|
-
const styles$
|
|
7103
|
+
const styles$4 = {
|
|
6968
7104
|
item: item$2,
|
|
6969
7105
|
itemContent,
|
|
6970
7106
|
itemActions,
|
|
@@ -7154,7 +7290,7 @@ function SortableComponentItem({
|
|
|
7154
7290
|
const isVoid = BlockManager.getBlockByType(component.block.type).void;
|
|
7155
7291
|
const hasBlockChildren = !isVoid && component.block.children.every((child) => NodeUtils.isBlockElement(child));
|
|
7156
7292
|
const hideWhenDragging = isDraggingLevel && !isCurrentDragging;
|
|
7157
|
-
return /* @__PURE__ */ React__default.createElement("div", { ref: setNodeRef, style, className: styles$
|
|
7293
|
+
return /* @__PURE__ */ React__default.createElement("div", { ref: setNodeRef, style, className: styles$4.sortableItem }, /* @__PURE__ */ React__default.createElement(
|
|
7158
7294
|
ComponentItem,
|
|
7159
7295
|
{
|
|
7160
7296
|
component,
|
|
@@ -7164,7 +7300,7 @@ function SortableComponentItem({
|
|
|
7164
7300
|
onToggleCollapse,
|
|
7165
7301
|
dragHandleProps: __spreadValues(__spreadValues({}, attributes), listeners)
|
|
7166
7302
|
}
|
|
7167
|
-
), hasBlockChildren && !isCollapsed && !isDragging && !hideWhenDragging && /* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
7303
|
+
), hasBlockChildren && !isCollapsed && !isDragging && !hideWhenDragging && /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemChildren }, /* @__PURE__ */ React__default.createElement(
|
|
7168
7304
|
ElementList,
|
|
7169
7305
|
{
|
|
7170
7306
|
blocks: component.block.children,
|
|
@@ -7229,10 +7365,10 @@ function ComponentItem({
|
|
|
7229
7365
|
}
|
|
7230
7366
|
return text;
|
|
7231
7367
|
}, [component.block, label]);
|
|
7232
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
7368
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: styles$4.item, onClick }, /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemContent }, /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemTitle }, /* @__PURE__ */ React__default.createElement(
|
|
7233
7369
|
"div",
|
|
7234
7370
|
{
|
|
7235
|
-
className: styles$
|
|
7371
|
+
className: styles$4.itemCollapse,
|
|
7236
7372
|
style: { opacity: hasBlockChildren ? 1 : 0 },
|
|
7237
7373
|
onClick: handleCollapseClick
|
|
7238
7374
|
},
|
|
@@ -7246,27 +7382,27 @@ function ComponentItem({
|
|
|
7246
7382
|
},
|
|
7247
7383
|
collapseIcon
|
|
7248
7384
|
)
|
|
7249
|
-
), /* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
7385
|
+
), /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemLabelWrapper }, /* @__PURE__ */ React__default.createElement(
|
|
7250
7386
|
SharedComponents.ElementIcon,
|
|
7251
7387
|
{
|
|
7252
7388
|
type: component.block.type,
|
|
7253
7389
|
width: 16,
|
|
7254
7390
|
height: 16
|
|
7255
7391
|
}
|
|
7256
|
-
), /* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
7392
|
+
), /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemLabel }, displayLabel))), /* @__PURE__ */ React__default.createElement(
|
|
7257
7393
|
"div",
|
|
7258
7394
|
{
|
|
7259
|
-
className: styles$
|
|
7395
|
+
className: styles$4.itemActions,
|
|
7260
7396
|
onClick: (e) => e.stopPropagation()
|
|
7261
7397
|
},
|
|
7262
|
-
/* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
7398
|
+
/* @__PURE__ */ React__default.createElement("div", { className: styles$4.action, onClick: onRemove }, /* @__PURE__ */ React__default.createElement(IconDelete, null)),
|
|
7263
7399
|
/* @__PURE__ */ React__default.createElement(
|
|
7264
7400
|
"div",
|
|
7265
7401
|
__spreadValues({
|
|
7266
7402
|
style: {
|
|
7267
7403
|
cursor: "grab"
|
|
7268
7404
|
},
|
|
7269
|
-
className: styles$
|
|
7405
|
+
className: styles$4.action
|
|
7270
7406
|
}, dragHandleProps),
|
|
7271
7407
|
/* @__PURE__ */ React__default.createElement("svg", { viewBox: "0 0 20 20", width: "12" }, /* @__PURE__ */ React__default.createElement("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }))
|
|
7272
7408
|
)
|
|
@@ -7919,16 +8055,28 @@ const TabHeader = (props) => {
|
|
|
7919
8055
|
/* @__PURE__ */ React__default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ React__default.createElement(Button$2.Group, null, /* @__PURE__ */ React__default.createElement(
|
|
7920
8056
|
Button$2,
|
|
7921
8057
|
{
|
|
7922
|
-
style: {
|
|
7923
|
-
|
|
8058
|
+
style: {
|
|
8059
|
+
paddingLeft: grid,
|
|
8060
|
+
paddingRight: grid,
|
|
8061
|
+
borderColor: !isMobileActive ? void 0 : "#000",
|
|
8062
|
+
color: !isMobileActive ? void 0 : "#000",
|
|
8063
|
+
borderRightColor: !isMobileActive ? void 0 : "transparent"
|
|
8064
|
+
},
|
|
8065
|
+
type: "outline",
|
|
7924
8066
|
onClick: () => onChangeTab(ActiveTabKeys.DESKTOP)
|
|
7925
8067
|
},
|
|
7926
8068
|
/* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-desktop" }), " ", t("desktop"))
|
|
7927
8069
|
), /* @__PURE__ */ React__default.createElement(
|
|
7928
8070
|
Button$2,
|
|
7929
8071
|
{
|
|
7930
|
-
style: {
|
|
7931
|
-
|
|
8072
|
+
style: {
|
|
8073
|
+
paddingLeft: grid,
|
|
8074
|
+
paddingRight: grid,
|
|
8075
|
+
borderColor: isMobileActive ? void 0 : "#000",
|
|
8076
|
+
color: isMobileActive ? void 0 : "#000",
|
|
8077
|
+
borderLeftColor: isMobileActive ? void 0 : "transparent"
|
|
8078
|
+
},
|
|
8079
|
+
type: "outline",
|
|
7932
8080
|
onClick: () => onChangeTab(ActiveTabKeys.MOBILE)
|
|
7933
8081
|
},
|
|
7934
8082
|
/* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-mobile" }), " ", t("mobile"))
|
|
@@ -7948,7 +8096,7 @@ const TabHeader = (props) => {
|
|
|
7948
8096
|
));
|
|
7949
8097
|
};
|
|
7950
8098
|
const hoverUnderline = "_hoverUnderline_8d8dl_1";
|
|
7951
|
-
const styles$
|
|
8099
|
+
const styles$3 = {
|
|
7952
8100
|
hoverUnderline
|
|
7953
8101
|
};
|
|
7954
8102
|
function BlockPaths({
|
|
@@ -8010,7 +8158,7 @@ function BlockPaths({
|
|
|
8010
8158
|
/* @__PURE__ */ React__default.createElement(
|
|
8011
8159
|
"span",
|
|
8012
8160
|
{
|
|
8013
|
-
className: styles$
|
|
8161
|
+
className: styles$3.hoverUnderline,
|
|
8014
8162
|
onClick: () => setSelectedNodePath(item2.path)
|
|
8015
8163
|
},
|
|
8016
8164
|
item2.name
|
|
@@ -25019,15 +25167,25 @@ const DefaultButton = (props) => {
|
|
|
25019
25167
|
const ButtonField = enhancer(DefaultButton);
|
|
25020
25168
|
const DefaultButtonGroup = (props) => {
|
|
25021
25169
|
const _a = props, { options: options2, value, onChange } = _a, rest = __objRest(_a, ["options", "value", "onChange"]);
|
|
25022
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
25170
|
+
return /* @__PURE__ */ React__default.createElement(Grid.Row, { justify: "center" }, /* @__PURE__ */ React__default.createElement(
|
|
25023
25171
|
Radio.Group,
|
|
25024
|
-
__spreadProps(__spreadValues({
|
|
25172
|
+
__spreadProps(__spreadValues({
|
|
25173
|
+
style: { width: "100%", display: "flex" }
|
|
25174
|
+
}, rest), {
|
|
25025
25175
|
value,
|
|
25026
25176
|
type: "button",
|
|
25027
|
-
options: options2,
|
|
25028
25177
|
onChange
|
|
25029
|
-
})
|
|
25030
|
-
|
|
25178
|
+
}),
|
|
25179
|
+
options2.map((option) => /* @__PURE__ */ React__default.createElement(
|
|
25180
|
+
Radio,
|
|
25181
|
+
{
|
|
25182
|
+
style: { width: `${(100 / options2.length).toFixed(2)}%` },
|
|
25183
|
+
key: option.value,
|
|
25184
|
+
value: option.value
|
|
25185
|
+
},
|
|
25186
|
+
/* @__PURE__ */ React__default.createElement("div", { style: { width: "100%", textAlign: "center" } }, option.label)
|
|
25187
|
+
))
|
|
25188
|
+
));
|
|
25031
25189
|
};
|
|
25032
25190
|
const ButtonGroupField = enhancer(DefaultButtonGroup);
|
|
25033
25191
|
var colorString$1 = { exports: {} };
|
|
@@ -26663,7 +26821,7 @@ const directionAdapter = {
|
|
|
26663
26821
|
};
|
|
26664
26822
|
const transparentIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAABAElEQVRIie2WwW7CMBBEZ8NKOJd8CPRABVVJ+fxUUEgQPbT9kBziFAWbU4FkjXCBICExtxk9Z7KxZYWSJLFoiJmbEYwxMMaI/JC1dv+oQmvE8QTWWvDo5VUs/FwtHSUWvmxTwUniQhHRdUuIyJm3Oslf6dVLmtMQEfhjNhVgFEUiq6oCvmye5zXPSnUF1Os/iSxLF/BlZ9P3mm9tTw4/231uvKuo9RIA4MHzUITHrgpfNgxDFFrv/E0meZT8S/zz/SXCsvyVIDP82U7dr9cSGsdvIsvSBXzZm10rj5KzJf99AGTpXGRB4H4fF6uUgi7LfYnrCLq18eSAqtpAddXObwEoMVtvVloS0QAAAABJRU5ErkJggg==";
|
|
26665
26823
|
const transparentColor$1 = "rgba(0,0,0,0)";
|
|
26666
|
-
|
|
26824
|
+
const ColorPickerContainer = (props) => {
|
|
26667
26825
|
const {
|
|
26668
26826
|
value = "",
|
|
26669
26827
|
onChange,
|
|
@@ -26719,7 +26877,7 @@ function ColorPicker$1(props) {
|
|
|
26719
26877
|
title: "",
|
|
26720
26878
|
trigger: "click"
|
|
26721
26879
|
}, props), {
|
|
26722
|
-
className: "color-picker-popup",
|
|
26880
|
+
className: "easy-email-pro-theme-color-picker-popup",
|
|
26723
26881
|
content: /* @__PURE__ */ React__default.createElement(
|
|
26724
26882
|
ColorPickerContent,
|
|
26725
26883
|
{
|
|
@@ -26732,6 +26890,7 @@ function ColorPicker$1(props) {
|
|
|
26732
26890
|
children || /* @__PURE__ */ React__default.createElement(
|
|
26733
26891
|
"div",
|
|
26734
26892
|
{
|
|
26893
|
+
className: "easy-email-pro-theme-color-picker-trigger",
|
|
26735
26894
|
style: {
|
|
26736
26895
|
display: "inline-block",
|
|
26737
26896
|
height: 32,
|
|
@@ -26784,6 +26943,7 @@ function ColorPicker$1(props) {
|
|
|
26784
26943
|
), showInput && /* @__PURE__ */ React__default.createElement(
|
|
26785
26944
|
Input,
|
|
26786
26945
|
{
|
|
26946
|
+
className: "easy-email-pro-theme-color-picker-input",
|
|
26787
26947
|
prefix: !isPageVarMatch && !isTemplateVarMatch && !value.includes("rgb") ? "#" : "",
|
|
26788
26948
|
value: inputColor,
|
|
26789
26949
|
style: { outline: "none", flex: 1 },
|
|
@@ -26793,10 +26953,13 @@ function ColorPicker$1(props) {
|
|
|
26793
26953
|
placeholder: placeholder == null ? void 0 : placeholder.replace("#", "")
|
|
26794
26954
|
}
|
|
26795
26955
|
));
|
|
26796
|
-
}
|
|
26956
|
+
};
|
|
26957
|
+
const ColorPicker$1 = (props) => {
|
|
26958
|
+
return /* @__PURE__ */ React__default.createElement(ColorProvider, null, /* @__PURE__ */ React__default.createElement(ColorPickerContainer, __spreadValues({}, props)));
|
|
26959
|
+
};
|
|
26797
26960
|
const DefaultColorPicker = enhancer(ColorPicker$1);
|
|
26798
26961
|
const ColorPickerField = (props) => {
|
|
26799
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
26962
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
26800
26963
|
DefaultColorPicker,
|
|
26801
26964
|
__spreadProps(__spreadValues({}, props), {
|
|
26802
26965
|
formItem: __spreadValues(__spreadProps(__spreadValues({}, colorAdapter), {
|
|
@@ -26818,7 +26981,7 @@ const ColorPickerField = (props) => {
|
|
|
26818
26981
|
]
|
|
26819
26982
|
}), props.formItem)
|
|
26820
26983
|
})
|
|
26821
|
-
)
|
|
26984
|
+
);
|
|
26822
26985
|
};
|
|
26823
26986
|
const idMap = /* @__PURE__ */ new Map();
|
|
26824
26987
|
function reorder(list, startIndex, endIndex) {
|
|
@@ -27137,7 +27300,7 @@ const cardItemLeft = "_cardItemLeft_8uw8m_71";
|
|
|
27137
27300
|
const cardItemRight = "_cardItemRight_8uw8m_85";
|
|
27138
27301
|
const selectImage = "_selectImage_8uw8m_93";
|
|
27139
27302
|
const exportFreeImage = "_exportFreeImage_8uw8m_110";
|
|
27140
|
-
const styles$
|
|
27303
|
+
const styles$2 = {
|
|
27141
27304
|
container,
|
|
27142
27305
|
error,
|
|
27143
27306
|
item,
|
|
@@ -27356,7 +27519,7 @@ function ImageUploader(props) {
|
|
|
27356
27519
|
);
|
|
27357
27520
|
const content = useMemo(() => {
|
|
27358
27521
|
if (isUploading) {
|
|
27359
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
27522
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: styles$2["item"] }, /* @__PURE__ */ React__default.createElement("div", { className: classnames$1(styles$2["info"]) }, /* @__PURE__ */ React__default.createElement(Spin, { size: 60 }), /* @__PURE__ */ React__default.createElement("div", { className: styles$2["btn-wrap"] })));
|
|
27360
27523
|
}
|
|
27361
27524
|
if (!props.value) {
|
|
27362
27525
|
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(
|
|
@@ -27377,10 +27540,10 @@ function ImageUploader(props) {
|
|
|
27377
27540
|
lineHeight: "22px"
|
|
27378
27541
|
}
|
|
27379
27542
|
},
|
|
27380
|
-
unsplashClientId ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: styles$
|
|
27543
|
+
unsplashClientId ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: styles$2.selectImage, onClick: onUpload }, t("Select image")), /* @__PURE__ */ React__default.createElement(
|
|
27381
27544
|
"div",
|
|
27382
27545
|
{
|
|
27383
|
-
className: styles$
|
|
27546
|
+
className: styles$2.exportFreeImage,
|
|
27384
27547
|
onClick: () => setUnsplashVisible(true)
|
|
27385
27548
|
},
|
|
27386
27549
|
t("Export free images")
|
|
@@ -27426,7 +27589,7 @@ function ImageUploader(props) {
|
|
|
27426
27589
|
triggerProps: {
|
|
27427
27590
|
popupStyle: { display: "inline-flex" }
|
|
27428
27591
|
},
|
|
27429
|
-
triggerElement: /* @__PURE__ */ React__default.createElement("span", { className: styles$
|
|
27592
|
+
triggerElement: /* @__PURE__ */ React__default.createElement("span", { className: styles$2.actionItem }, t("Replace"))
|
|
27430
27593
|
},
|
|
27431
27594
|
/* @__PURE__ */ React__default.createElement(Select$1.Option, { value: "1", onClick: onUpload }, t("Select image")),
|
|
27432
27595
|
/* @__PURE__ */ React__default.createElement(
|
|
@@ -27437,10 +27600,10 @@ function ImageUploader(props) {
|
|
|
27437
27600
|
},
|
|
27438
27601
|
t("Export free images")
|
|
27439
27602
|
)
|
|
27440
|
-
) : /* @__PURE__ */ React__default.createElement("span", { className: styles$
|
|
27603
|
+
) : /* @__PURE__ */ React__default.createElement("span", { className: styles$2.actionItem, onClick: onUpload }, t("Replace")), enablePreview && /* @__PURE__ */ React__default.createElement("span", null, " ∙ "), enablePreview && /* @__PURE__ */ React__default.createElement(
|
|
27441
27604
|
"span",
|
|
27442
27605
|
{
|
|
27443
|
-
className: styles$
|
|
27606
|
+
className: styles$2.actionItem,
|
|
27444
27607
|
onClick: () => setPreview(true)
|
|
27445
27608
|
},
|
|
27446
27609
|
t("Preview")
|
|
@@ -27908,11 +28071,621 @@ function PixelField(props) {
|
|
|
27908
28071
|
})
|
|
27909
28072
|
);
|
|
27910
28073
|
}
|
|
28074
|
+
const controlSection = "_controlSection_1t3ne_1";
|
|
28075
|
+
const controlGroup = "_controlGroup_1t3ne_7";
|
|
28076
|
+
const colorHeader = "_colorHeader_1t3ne_11";
|
|
28077
|
+
const colorList = "_colorList_1t3ne_18";
|
|
28078
|
+
const colorItem = "_colorItem_1t3ne_34";
|
|
28079
|
+
const positionControl = "_positionControl_1t3ne_44";
|
|
28080
|
+
const percentSign = "_percentSign_1t3ne_50";
|
|
28081
|
+
const deleteButton = "_deleteButton_1t3ne_55";
|
|
28082
|
+
const sizeInputs = "_sizeInputs_1t3ne_62";
|
|
28083
|
+
const styles$1 = {
|
|
28084
|
+
controlSection,
|
|
28085
|
+
controlGroup,
|
|
28086
|
+
colorHeader,
|
|
28087
|
+
colorList,
|
|
28088
|
+
colorItem,
|
|
28089
|
+
positionControl,
|
|
28090
|
+
percentSign,
|
|
28091
|
+
deleteButton,
|
|
28092
|
+
sizeInputs
|
|
28093
|
+
};
|
|
28094
|
+
const MAX_COLORS = 4;
|
|
28095
|
+
const MIN_COLORS = 2;
|
|
28096
|
+
const GRADIENT_PRESETS = [
|
|
28097
|
+
{
|
|
28098
|
+
value: "1",
|
|
28099
|
+
colors: [
|
|
28100
|
+
{ color: "#2CD8D5", position: 0 },
|
|
28101
|
+
{ color: "#C5C1FF", position: 56 },
|
|
28102
|
+
{ color: "#FFBAC3", position: 100 }
|
|
28103
|
+
],
|
|
28104
|
+
label: "Prism"
|
|
28105
|
+
},
|
|
28106
|
+
{
|
|
28107
|
+
value: "2",
|
|
28108
|
+
colors: [
|
|
28109
|
+
{ color: "#00C6FB", position: 0 },
|
|
28110
|
+
{ color: "#005BEA", position: 100 }
|
|
28111
|
+
],
|
|
28112
|
+
label: "Ocean"
|
|
28113
|
+
},
|
|
28114
|
+
{
|
|
28115
|
+
value: "3",
|
|
28116
|
+
colors: [
|
|
28117
|
+
{ color: "#F6D365", position: 0 },
|
|
28118
|
+
{ color: "#FDA085", position: 100 }
|
|
28119
|
+
],
|
|
28120
|
+
label: "Sun"
|
|
28121
|
+
},
|
|
28122
|
+
{
|
|
28123
|
+
value: "4",
|
|
28124
|
+
colors: [
|
|
28125
|
+
{ color: "#21D4FD", position: 0 },
|
|
28126
|
+
{ color: "#B721FF", position: 100 }
|
|
28127
|
+
],
|
|
28128
|
+
label: "Purple"
|
|
28129
|
+
},
|
|
28130
|
+
{
|
|
28131
|
+
value: "5",
|
|
28132
|
+
colors: [
|
|
28133
|
+
{ color: "#3EECAC", position: 0 },
|
|
28134
|
+
{ color: "#EE74E1", position: 100 }
|
|
28135
|
+
],
|
|
28136
|
+
label: "Aurora"
|
|
28137
|
+
},
|
|
28138
|
+
{
|
|
28139
|
+
value: "6",
|
|
28140
|
+
colors: [
|
|
28141
|
+
{ color: "#FA8BFF", position: 0 },
|
|
28142
|
+
{ color: "#2BD2FF", position: 52 },
|
|
28143
|
+
{ color: "#2BFF88", position: 100 }
|
|
28144
|
+
],
|
|
28145
|
+
label: "Rainbow"
|
|
28146
|
+
},
|
|
28147
|
+
{
|
|
28148
|
+
value: "7",
|
|
28149
|
+
colors: [
|
|
28150
|
+
{ color: "#08AEEA", position: 0 },
|
|
28151
|
+
{ color: "#2AF598", position: 100 }
|
|
28152
|
+
],
|
|
28153
|
+
label: "Mint"
|
|
28154
|
+
},
|
|
28155
|
+
{
|
|
28156
|
+
value: "8",
|
|
28157
|
+
colors: [
|
|
28158
|
+
{ color: "#FBAB7E", position: 0 },
|
|
28159
|
+
{ color: "#F7CE68", position: 100 }
|
|
28160
|
+
],
|
|
28161
|
+
label: "Amber"
|
|
28162
|
+
},
|
|
28163
|
+
{
|
|
28164
|
+
value: "9",
|
|
28165
|
+
colors: [
|
|
28166
|
+
{ color: "#85FFBD", position: 0 },
|
|
28167
|
+
{ color: "#FFFB7D", position: 100 }
|
|
28168
|
+
],
|
|
28169
|
+
label: "Lime"
|
|
28170
|
+
},
|
|
28171
|
+
{
|
|
28172
|
+
value: "10",
|
|
28173
|
+
colors: [
|
|
28174
|
+
{ color: "#FF3CAC", position: 0 },
|
|
28175
|
+
{ color: "#784BA0", position: 50 },
|
|
28176
|
+
{ color: "#2B86C5", position: 100 }
|
|
28177
|
+
],
|
|
28178
|
+
label: "Dream"
|
|
28179
|
+
},
|
|
28180
|
+
{
|
|
28181
|
+
value: "11",
|
|
28182
|
+
colors: [
|
|
28183
|
+
{ color: "#0093E9", position: 0 },
|
|
28184
|
+
{ color: "#80D0C7", position: 100 }
|
|
28185
|
+
],
|
|
28186
|
+
label: "Aqua"
|
|
28187
|
+
},
|
|
28188
|
+
{
|
|
28189
|
+
value: "12",
|
|
28190
|
+
colors: [
|
|
28191
|
+
{ color: "#D9AFD9", position: 0 },
|
|
28192
|
+
{ color: "#97D9E1", position: 100 }
|
|
28193
|
+
],
|
|
28194
|
+
label: "Lilac"
|
|
28195
|
+
},
|
|
28196
|
+
{
|
|
28197
|
+
value: "13",
|
|
28198
|
+
colors: [
|
|
28199
|
+
{ color: "#8BC6EC", position: 0 },
|
|
28200
|
+
{ color: "#9599E2", position: 100 }
|
|
28201
|
+
],
|
|
28202
|
+
label: "Violet"
|
|
28203
|
+
},
|
|
28204
|
+
{
|
|
28205
|
+
value: "14",
|
|
28206
|
+
colors: [
|
|
28207
|
+
{ color: "#A9C9FF", position: 0 },
|
|
28208
|
+
{ color: "#FFBBEC", position: 100 }
|
|
28209
|
+
],
|
|
28210
|
+
label: "Pink"
|
|
28211
|
+
},
|
|
28212
|
+
{
|
|
28213
|
+
value: "15",
|
|
28214
|
+
colors: [
|
|
28215
|
+
{ color: "#FEE140", position: 0 },
|
|
28216
|
+
{ color: "#FA709A", position: 100 }
|
|
28217
|
+
],
|
|
28218
|
+
label: "Peach"
|
|
28219
|
+
},
|
|
28220
|
+
{
|
|
28221
|
+
value: "16",
|
|
28222
|
+
colors: [
|
|
28223
|
+
{ color: "#00DBDE", position: 0 },
|
|
28224
|
+
{ color: "#FC00FF", position: 100 }
|
|
28225
|
+
],
|
|
28226
|
+
label: "Neon"
|
|
28227
|
+
},
|
|
28228
|
+
{
|
|
28229
|
+
value: "17",
|
|
28230
|
+
colors: [
|
|
28231
|
+
{ color: "#4158D0", position: 0 },
|
|
28232
|
+
{ color: "#C850C0", position: 46 },
|
|
28233
|
+
{ color: "#FFCC70", position: 100 }
|
|
28234
|
+
],
|
|
28235
|
+
label: "Sunset"
|
|
28236
|
+
},
|
|
28237
|
+
{
|
|
28238
|
+
value: "18",
|
|
28239
|
+
colors: [
|
|
28240
|
+
{ color: "#0BA360", position: 0 },
|
|
28241
|
+
{ color: "#3CBA92", position: 100 }
|
|
28242
|
+
],
|
|
28243
|
+
label: "Jade"
|
|
28244
|
+
},
|
|
28245
|
+
{
|
|
28246
|
+
value: "19",
|
|
28247
|
+
colors: [
|
|
28248
|
+
{ color: "#FFDEE9", position: 0 },
|
|
28249
|
+
{ color: "#B5FFFC", position: 100 }
|
|
28250
|
+
],
|
|
28251
|
+
label: "Candy"
|
|
28252
|
+
},
|
|
28253
|
+
{
|
|
28254
|
+
value: "20",
|
|
28255
|
+
colors: [
|
|
28256
|
+
{ color: "#74EBD5", position: 0 },
|
|
28257
|
+
{ color: "#9FACE6", position: 100 }
|
|
28258
|
+
],
|
|
28259
|
+
label: "Dawn"
|
|
28260
|
+
}
|
|
28261
|
+
];
|
|
28262
|
+
function GradientGenerator(props) {
|
|
28263
|
+
const [loading, setLoading] = useState(false);
|
|
28264
|
+
const { setLock } = useEditorState();
|
|
28265
|
+
const canvasRef = useRef(null);
|
|
28266
|
+
const { isOpen, setIsOpen } = props;
|
|
28267
|
+
const { resetSelectedNode } = useElementInteract();
|
|
28268
|
+
const { lastSelectedNode, isChanged } = useLastSelectedNode();
|
|
28269
|
+
const changeRef = useRefState(isChanged);
|
|
28270
|
+
const { selectedNode } = useSelectedNode();
|
|
28271
|
+
const data = props.data;
|
|
28272
|
+
const colors = data.colors;
|
|
28273
|
+
const lock = useLockState();
|
|
28274
|
+
const onChangeRef = useRefState(props.onChange);
|
|
28275
|
+
const setData = useCallback(
|
|
28276
|
+
(val) => {
|
|
28277
|
+
onChangeRef.current(val);
|
|
28278
|
+
},
|
|
28279
|
+
[onChangeRef]
|
|
28280
|
+
);
|
|
28281
|
+
const addColor = () => {
|
|
28282
|
+
if (colors.length >= MAX_COLORS) {
|
|
28283
|
+
Message.warning(t(`Maximum 4 colors allowed`));
|
|
28284
|
+
return;
|
|
28285
|
+
}
|
|
28286
|
+
const newColor = {
|
|
28287
|
+
id: nanoid(),
|
|
28288
|
+
color: "#ffffff",
|
|
28289
|
+
position: 50
|
|
28290
|
+
};
|
|
28291
|
+
setData(__spreadProps(__spreadValues({}, data), {
|
|
28292
|
+
colors: [...colors, newColor].sort((a, b) => a.position - b.position)
|
|
28293
|
+
}));
|
|
28294
|
+
};
|
|
28295
|
+
const previewRef = useRefState(props.onPreview);
|
|
28296
|
+
const removeColor = (index2) => {
|
|
28297
|
+
const newColors = cloneDeep(colors).filter((_, i) => i !== index2);
|
|
28298
|
+
setData(__spreadProps(__spreadValues({}, data), {
|
|
28299
|
+
colors: newColors.sort((a, b) => a.position - b.position)
|
|
28300
|
+
}));
|
|
28301
|
+
};
|
|
28302
|
+
const generateGradientBlob = useCallback(
|
|
28303
|
+
(params) => __async(this, null, function* () {
|
|
28304
|
+
const { colors: colors2, gradientAngle, gradientSize, gradientType } = params;
|
|
28305
|
+
const canvas = canvasRef.current;
|
|
28306
|
+
if (!canvas)
|
|
28307
|
+
return;
|
|
28308
|
+
const ctx = canvas.getContext("2d");
|
|
28309
|
+
if (!ctx)
|
|
28310
|
+
return;
|
|
28311
|
+
const size = gradientSize;
|
|
28312
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28313
|
+
canvas.width = size.width;
|
|
28314
|
+
canvas.height = size.height;
|
|
28315
|
+
let gradient;
|
|
28316
|
+
if (gradientType === "linear") {
|
|
28317
|
+
const canvasAngle = (360 - gradientAngle + 90) % 360 * Math.PI / 180;
|
|
28318
|
+
const x1 = size.width / 2 - Math.cos(canvasAngle) * size.width / 2;
|
|
28319
|
+
const y1 = size.height / 2 - Math.sin(canvasAngle) * size.height / 2;
|
|
28320
|
+
const x2 = size.width / 2 + Math.cos(canvasAngle) * size.width / 2;
|
|
28321
|
+
const y2 = size.height / 2 + Math.sin(canvasAngle) * size.height / 2;
|
|
28322
|
+
gradient = ctx.createLinearGradient(x1, y1, x2, y2);
|
|
28323
|
+
} else {
|
|
28324
|
+
gradient = ctx.createRadialGradient(
|
|
28325
|
+
size.width / 2,
|
|
28326
|
+
size.height / 2,
|
|
28327
|
+
0,
|
|
28328
|
+
size.width / 2,
|
|
28329
|
+
size.height / 2,
|
|
28330
|
+
Math.min(size.width, size.height) / 2
|
|
28331
|
+
);
|
|
28332
|
+
}
|
|
28333
|
+
colors2.forEach((color2) => {
|
|
28334
|
+
gradient.addColorStop(color2.position / 100, color2.color);
|
|
28335
|
+
});
|
|
28336
|
+
ctx.fillStyle = gradient;
|
|
28337
|
+
ctx.fillRect(0, 0, size.width, size.height);
|
|
28338
|
+
const blob = yield new Promise((resolve) => {
|
|
28339
|
+
canvas.toBlob((blob2) => {
|
|
28340
|
+
resolve(blob2);
|
|
28341
|
+
});
|
|
28342
|
+
});
|
|
28343
|
+
return blob;
|
|
28344
|
+
}),
|
|
28345
|
+
[]
|
|
28346
|
+
);
|
|
28347
|
+
const generatePreview = useCallback(
|
|
28348
|
+
debounce$2(
|
|
28349
|
+
(params) => {
|
|
28350
|
+
generateGradientBlob(params).then((blob) => {
|
|
28351
|
+
var _a;
|
|
28352
|
+
if (!blob)
|
|
28353
|
+
return;
|
|
28354
|
+
const url = URL.createObjectURL(blob);
|
|
28355
|
+
(_a = previewRef.current) == null ? void 0 : _a.call(previewRef, url);
|
|
28356
|
+
});
|
|
28357
|
+
},
|
|
28358
|
+
100
|
|
28359
|
+
),
|
|
28360
|
+
[generateGradientBlob, previewRef]
|
|
28361
|
+
);
|
|
28362
|
+
const handelSave = () => __async(this, null, function* () {
|
|
28363
|
+
var _a;
|
|
28364
|
+
const canvas = canvasRef.current;
|
|
28365
|
+
if (!canvas)
|
|
28366
|
+
return;
|
|
28367
|
+
try {
|
|
28368
|
+
setLoading(true);
|
|
28369
|
+
const blob = yield generateGradientBlob({
|
|
28370
|
+
colors,
|
|
28371
|
+
gradientAngle: data.angle,
|
|
28372
|
+
gradientSize: { width: data.width, height: data.height },
|
|
28373
|
+
gradientType: data.type
|
|
28374
|
+
});
|
|
28375
|
+
if (!blob)
|
|
28376
|
+
return;
|
|
28377
|
+
yield (_a = props.onSave) == null ? void 0 : _a.call(props, data, blob);
|
|
28378
|
+
handleClose();
|
|
28379
|
+
} catch (error2) {
|
|
28380
|
+
console.error(error2);
|
|
28381
|
+
Message.error(t(`Save failed`));
|
|
28382
|
+
} finally {
|
|
28383
|
+
setLoading(false);
|
|
28384
|
+
}
|
|
28385
|
+
});
|
|
28386
|
+
useEffect(() => {
|
|
28387
|
+
if (!isOpen)
|
|
28388
|
+
return;
|
|
28389
|
+
if (!changeRef.current)
|
|
28390
|
+
return;
|
|
28391
|
+
generatePreview({
|
|
28392
|
+
colors,
|
|
28393
|
+
gradientAngle: data.angle,
|
|
28394
|
+
gradientSize: {
|
|
28395
|
+
width: data.width,
|
|
28396
|
+
height: data.height
|
|
28397
|
+
},
|
|
28398
|
+
gradientType: data.type
|
|
28399
|
+
});
|
|
28400
|
+
return () => {
|
|
28401
|
+
generatePreview.cancel();
|
|
28402
|
+
};
|
|
28403
|
+
}, [
|
|
28404
|
+
colors,
|
|
28405
|
+
generatePreview,
|
|
28406
|
+
data.angle,
|
|
28407
|
+
data.width,
|
|
28408
|
+
data.height,
|
|
28409
|
+
data.type,
|
|
28410
|
+
isOpen,
|
|
28411
|
+
changeRef
|
|
28412
|
+
]);
|
|
28413
|
+
useEffect(() => {
|
|
28414
|
+
if (lastSelectedNode.current && !isEqual(lastSelectedNode.current, selectedNode)) {
|
|
28415
|
+
console.log("set lock");
|
|
28416
|
+
setLock(true);
|
|
28417
|
+
} else {
|
|
28418
|
+
resetSelectedNode();
|
|
28419
|
+
setLock(false);
|
|
28420
|
+
}
|
|
28421
|
+
}, [lastSelectedNode, selectedNode, setLock, resetSelectedNode]);
|
|
28422
|
+
const handleClose = () => {
|
|
28423
|
+
lastSelectedNode.current = null;
|
|
28424
|
+
setIsOpen(false);
|
|
28425
|
+
setLock(false);
|
|
28426
|
+
};
|
|
28427
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
28428
|
+
Drawer,
|
|
28429
|
+
{
|
|
28430
|
+
className: "GradientGeneratorDrawer",
|
|
28431
|
+
bodyStyle: {
|
|
28432
|
+
paddingLeft: 0,
|
|
28433
|
+
paddingRight: 0,
|
|
28434
|
+
paddingTop: 0,
|
|
28435
|
+
paddingBottom: 60
|
|
28436
|
+
},
|
|
28437
|
+
closable: false,
|
|
28438
|
+
width: "100%",
|
|
28439
|
+
visible: isOpen && props.enable,
|
|
28440
|
+
getPopupContainer: () => {
|
|
28441
|
+
return document.body.querySelector("#ConfigurationDrawer") || document.body;
|
|
28442
|
+
},
|
|
28443
|
+
title: /* @__PURE__ */ React__default.createElement("div", { style: { textAlign: "left" } }, /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(
|
|
28444
|
+
Button$2,
|
|
28445
|
+
{
|
|
28446
|
+
type: "text",
|
|
28447
|
+
icon: /* @__PURE__ */ React__default.createElement(IconLeft, null),
|
|
28448
|
+
disabled: lock,
|
|
28449
|
+
onClick: handleClose
|
|
28450
|
+
}
|
|
28451
|
+
), /* @__PURE__ */ React__default.createElement(IconPalette, null), " ", t(`Gradient Generator`))),
|
|
28452
|
+
okButtonProps: {
|
|
28453
|
+
type: "primary",
|
|
28454
|
+
onClick: handelSave,
|
|
28455
|
+
loading
|
|
28456
|
+
},
|
|
28457
|
+
okText: t(`Generate`),
|
|
28458
|
+
cancelText: t(`Cancel`),
|
|
28459
|
+
onCancel: handleClose,
|
|
28460
|
+
cancelButtonProps: {
|
|
28461
|
+
disabled: lock
|
|
28462
|
+
}
|
|
28463
|
+
},
|
|
28464
|
+
/* @__PURE__ */ React__default.createElement("div", { key: isOpen.toString() }, isChanged && lock && /* @__PURE__ */ React__default.createElement(
|
|
28465
|
+
Alert,
|
|
28466
|
+
{
|
|
28467
|
+
type: "warning",
|
|
28468
|
+
content: /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("span", null, t(`Content has been modified. Please save before leaving.`)), " ", /* @__PURE__ */ React__default.createElement(
|
|
28469
|
+
Popconfirm,
|
|
28470
|
+
{
|
|
28471
|
+
focusLock: true,
|
|
28472
|
+
title: t("Do you want to discard?"),
|
|
28473
|
+
okText: t("Discard"),
|
|
28474
|
+
cancelText: t("Cancel"),
|
|
28475
|
+
style: { zIndex: 9999 },
|
|
28476
|
+
getPopupContainer: () => document.body,
|
|
28477
|
+
okButtonProps: {
|
|
28478
|
+
status: "danger"
|
|
28479
|
+
},
|
|
28480
|
+
onOk: () => {
|
|
28481
|
+
resetSelectedNode();
|
|
28482
|
+
handleClose();
|
|
28483
|
+
}
|
|
28484
|
+
},
|
|
28485
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28486
|
+
"span",
|
|
28487
|
+
{
|
|
28488
|
+
style: {
|
|
28489
|
+
color: "rgb(var(--danger-6))",
|
|
28490
|
+
cursor: "pointer"
|
|
28491
|
+
}
|
|
28492
|
+
},
|
|
28493
|
+
t("Discard")
|
|
28494
|
+
)
|
|
28495
|
+
))
|
|
28496
|
+
}
|
|
28497
|
+
), /* @__PURE__ */ React__default.createElement("div", { className: styles$1.controlSection }, /* @__PURE__ */ React__default.createElement("div", { className: styles$1.controlGroup }, /* @__PURE__ */ React__default.createElement(
|
|
28498
|
+
Form.Item,
|
|
28499
|
+
{
|
|
28500
|
+
label: /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(
|
|
28501
|
+
"div",
|
|
28502
|
+
{
|
|
28503
|
+
style: {
|
|
28504
|
+
display: "flex",
|
|
28505
|
+
alignItems: "center",
|
|
28506
|
+
gap: "4px"
|
|
28507
|
+
}
|
|
28508
|
+
},
|
|
28509
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28510
|
+
"div",
|
|
28511
|
+
{
|
|
28512
|
+
style: {
|
|
28513
|
+
width: "20px",
|
|
28514
|
+
height: "20px",
|
|
28515
|
+
display: "flex",
|
|
28516
|
+
alignItems: "center",
|
|
28517
|
+
justifyContent: "center",
|
|
28518
|
+
borderRadius: "4px",
|
|
28519
|
+
backgroundImage: "linear-gradient(to right, rgb(99, 102, 241), rgb(168, 85, 247))",
|
|
28520
|
+
color: "white"
|
|
28521
|
+
}
|
|
28522
|
+
},
|
|
28523
|
+
/* @__PURE__ */ React__default.createElement(IconPalette, { color: "white" })
|
|
28524
|
+
),
|
|
28525
|
+
/* @__PURE__ */ React__default.createElement("span", null, "Preset")
|
|
28526
|
+
)),
|
|
28527
|
+
layout: "vertical"
|
|
28528
|
+
},
|
|
28529
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28530
|
+
Select$1,
|
|
28531
|
+
{
|
|
28532
|
+
style: { width: "100%" },
|
|
28533
|
+
onChange: (value) => {
|
|
28534
|
+
const preset = GRADIENT_PRESETS.find(
|
|
28535
|
+
(p) => p.value === value
|
|
28536
|
+
);
|
|
28537
|
+
if (preset) {
|
|
28538
|
+
setData(__spreadProps(__spreadValues({}, data), {
|
|
28539
|
+
colors: preset.colors.map((c) => __spreadProps(__spreadValues({}, c), {
|
|
28540
|
+
id: nanoid()
|
|
28541
|
+
}))
|
|
28542
|
+
}));
|
|
28543
|
+
}
|
|
28544
|
+
}
|
|
28545
|
+
},
|
|
28546
|
+
GRADIENT_PRESETS.map((preset) => /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: preset.value, value: preset.value }, /* @__PURE__ */ React__default.createElement(
|
|
28547
|
+
"div",
|
|
28548
|
+
{
|
|
28549
|
+
style: {
|
|
28550
|
+
display: "flex",
|
|
28551
|
+
alignItems: "center",
|
|
28552
|
+
gap: "12px",
|
|
28553
|
+
width: "100%"
|
|
28554
|
+
}
|
|
28555
|
+
},
|
|
28556
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28557
|
+
"div",
|
|
28558
|
+
{
|
|
28559
|
+
style: {
|
|
28560
|
+
width: `calc(100% - 80px)`,
|
|
28561
|
+
height: "24px",
|
|
28562
|
+
borderRadius: "4px",
|
|
28563
|
+
backgroundImage: `linear-gradient(to right, ${preset.colors.map((c) => `${c.color} ${c.position}%`).join(", ")})`,
|
|
28564
|
+
flexShrink: 0
|
|
28565
|
+
}
|
|
28566
|
+
}
|
|
28567
|
+
),
|
|
28568
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28569
|
+
"div",
|
|
28570
|
+
{
|
|
28571
|
+
style: {
|
|
28572
|
+
fontSize: "12px",
|
|
28573
|
+
whiteSpace: "nowrap",
|
|
28574
|
+
overflow: "hidden",
|
|
28575
|
+
textOverflow: "ellipsis"
|
|
28576
|
+
}
|
|
28577
|
+
},
|
|
28578
|
+
preset.label
|
|
28579
|
+
)
|
|
28580
|
+
)))
|
|
28581
|
+
)
|
|
28582
|
+
)), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: "0px 0 10px 0" } }), /* @__PURE__ */ React__default.createElement("div", { className: styles$1.controlGroup }, /* @__PURE__ */ React__default.createElement(Form.Item, { label: t(`Gradient Type`), layout: "vertical" }, /* @__PURE__ */ React__default.createElement(
|
|
28583
|
+
Select$1,
|
|
28584
|
+
{
|
|
28585
|
+
style: { width: "100%" },
|
|
28586
|
+
options: [
|
|
28587
|
+
{
|
|
28588
|
+
label: t(`Linear Gradient`),
|
|
28589
|
+
value: "linear"
|
|
28590
|
+
},
|
|
28591
|
+
{
|
|
28592
|
+
label: t(`Radial Gradient`),
|
|
28593
|
+
value: "radial"
|
|
28594
|
+
}
|
|
28595
|
+
],
|
|
28596
|
+
value: data.type,
|
|
28597
|
+
onChange: (value) => {
|
|
28598
|
+
setData(__spreadProps(__spreadValues({}, data), {
|
|
28599
|
+
type: value
|
|
28600
|
+
}));
|
|
28601
|
+
}
|
|
28602
|
+
}
|
|
28603
|
+
))), /* @__PURE__ */ React__default.createElement("div", { className: styles$1.controlGroup }, /* @__PURE__ */ React__default.createElement(Grid.Row, null, /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 11 }, /* @__PURE__ */ React__default.createElement(Form.Item, { label: t(`Width`), layout: "vertical" }, /* @__PURE__ */ React__default.createElement(
|
|
28604
|
+
InputNumber,
|
|
28605
|
+
{
|
|
28606
|
+
style: { width: "100%" },
|
|
28607
|
+
value: data.width,
|
|
28608
|
+
onChange: (value) => {
|
|
28609
|
+
setData(__spreadProps(__spreadValues({}, data), { width: value }));
|
|
28610
|
+
}
|
|
28611
|
+
}
|
|
28612
|
+
))), /* @__PURE__ */ React__default.createElement(Grid.Col, { offset: 2, span: 11 }, /* @__PURE__ */ React__default.createElement(Form.Item, { label: t(`Height`), layout: "vertical" }, /* @__PURE__ */ React__default.createElement(
|
|
28613
|
+
InputNumber,
|
|
28614
|
+
{
|
|
28615
|
+
style: { width: "100%" },
|
|
28616
|
+
value: data.height,
|
|
28617
|
+
onChange: (value) => {
|
|
28618
|
+
setData(__spreadProps(__spreadValues({}, data), { height: value }));
|
|
28619
|
+
}
|
|
28620
|
+
}
|
|
28621
|
+
))))), /* @__PURE__ */ React__default.createElement(Divider$2, null), data.type === "linear" && /* @__PURE__ */ React__default.createElement("div", { className: styles$1.controlGroup }, /* @__PURE__ */ React__default.createElement(Form.Item, { label: t(`Angle`), layout: "vertical" }, /* @__PURE__ */ React__default.createElement(
|
|
28622
|
+
Slider,
|
|
28623
|
+
{
|
|
28624
|
+
value: data.angle,
|
|
28625
|
+
onChange: (value) => {
|
|
28626
|
+
setData(__spreadProps(__spreadValues({}, data), { angle: value }));
|
|
28627
|
+
},
|
|
28628
|
+
style: { width: "100%" },
|
|
28629
|
+
max: 360,
|
|
28630
|
+
min: 0,
|
|
28631
|
+
step: 1,
|
|
28632
|
+
showInput: true
|
|
28633
|
+
}
|
|
28634
|
+
))), /* @__PURE__ */ React__default.createElement(Divider$2, null), /* @__PURE__ */ React__default.createElement("div", { className: styles$1.controlGroup }, /* @__PURE__ */ React__default.createElement("div", { className: styles$1.colorHeader }, /* @__PURE__ */ React__default.createElement("div", { className: styles$1.label }, t(`Colors`), " (", colors.length, "/", MAX_COLORS, ")"), /* @__PURE__ */ React__default.createElement(
|
|
28635
|
+
Button$2,
|
|
28636
|
+
{
|
|
28637
|
+
type: "text",
|
|
28638
|
+
icon: /* @__PURE__ */ React__default.createElement(IconPlus, null),
|
|
28639
|
+
onClick: addColor,
|
|
28640
|
+
size: "small",
|
|
28641
|
+
disabled: colors.length >= MAX_COLORS
|
|
28642
|
+
},
|
|
28643
|
+
t(`Add Color`)
|
|
28644
|
+
)), /* @__PURE__ */ React__default.createElement("div", { className: styles$1.colorList }, colors.map((color2, index2) => /* @__PURE__ */ React__default.createElement("div", { key: color2.id, className: styles$1.colorItem }, /* @__PURE__ */ React__default.createElement("div", { className: styles$1.colorInputs }, /* @__PURE__ */ React__default.createElement(
|
|
28645
|
+
ColorPicker$1,
|
|
28646
|
+
{
|
|
28647
|
+
value: color2.color,
|
|
28648
|
+
onChange: (value) => {
|
|
28649
|
+
setData(__spreadProps(__spreadValues({}, data), {
|
|
28650
|
+
colors: data.colors.map(
|
|
28651
|
+
(c, i) => i === index2 ? __spreadProps(__spreadValues({}, c), { color: value }) : c
|
|
28652
|
+
)
|
|
28653
|
+
}));
|
|
28654
|
+
}
|
|
28655
|
+
}
|
|
28656
|
+
)), /* @__PURE__ */ React__default.createElement("div", { className: styles$1.positionControl }, /* @__PURE__ */ React__default.createElement(
|
|
28657
|
+
InputNumber,
|
|
28658
|
+
{
|
|
28659
|
+
value: color2.position,
|
|
28660
|
+
onChange: (value) => {
|
|
28661
|
+
setData(__spreadProps(__spreadValues({}, data), {
|
|
28662
|
+
colors: data.colors.map(
|
|
28663
|
+
(c, i) => i === index2 ? __spreadProps(__spreadValues({}, c), { position: value }) : c
|
|
28664
|
+
)
|
|
28665
|
+
}));
|
|
28666
|
+
},
|
|
28667
|
+
style: { width: "80px" },
|
|
28668
|
+
min: 0,
|
|
28669
|
+
max: 100
|
|
28670
|
+
}
|
|
28671
|
+
), /* @__PURE__ */ React__default.createElement("span", { className: styles$1.percentSign }, "%"), colors.length > MIN_COLORS && /* @__PURE__ */ React__default.createElement(
|
|
28672
|
+
Button$2,
|
|
28673
|
+
{
|
|
28674
|
+
type: "text",
|
|
28675
|
+
icon: /* @__PURE__ */ React__default.createElement(IconDelete, null),
|
|
28676
|
+
onClick: () => removeColor(index2),
|
|
28677
|
+
className: styles$1.deleteButton
|
|
28678
|
+
}
|
|
28679
|
+
)))))))),
|
|
28680
|
+
/* @__PURE__ */ React__default.createElement("canvas", { ref: canvasRef, style: { display: "none" } })
|
|
28681
|
+
);
|
|
28682
|
+
}
|
|
27911
28683
|
const TextField = enhancer(Input);
|
|
27912
28684
|
enhancer(Input.Search);
|
|
27913
28685
|
const TextAreaField = enhancer(Input.TextArea);
|
|
27914
28686
|
const NumberField = enhancer(InputNumber);
|
|
27915
28687
|
const SelectField = enhancer(Select);
|
|
28688
|
+
const GradientGeneratorField = enhancer(GradientGenerator);
|
|
27916
28689
|
function BackgroundColor(props) {
|
|
27917
28690
|
const { label = t("Background color") } = props;
|
|
27918
28691
|
return useMemo(() => {
|
|
@@ -28843,11 +29616,73 @@ const backgroundSizeOptions = [
|
|
|
28843
29616
|
}
|
|
28844
29617
|
];
|
|
28845
29618
|
function BackgroundImage(props) {
|
|
28846
|
-
const { getFieldValue } = useEditorContext();
|
|
28847
|
-
const
|
|
29619
|
+
const { getFieldValue: useGetFieldValue, setFieldValue } = useEditorContext();
|
|
29620
|
+
const editor = useSlateStatic();
|
|
29621
|
+
const { enabledGradientImage } = useEditorProps();
|
|
29622
|
+
const isEnabledImage = useGetFieldValue(
|
|
28848
29623
|
props.path,
|
|
28849
29624
|
props.name + ".background-image-enabled"
|
|
28850
29625
|
);
|
|
29626
|
+
const hasGradient = useGetFieldValue(props.path, "data.gradient");
|
|
29627
|
+
const isEnabledGradient = useGetFieldValue(
|
|
29628
|
+
props.path,
|
|
29629
|
+
"data.gradient.enabled"
|
|
29630
|
+
);
|
|
29631
|
+
const handleChangeEnabledGradient = useCallback(
|
|
29632
|
+
(value) => {
|
|
29633
|
+
if (hasGradient) {
|
|
29634
|
+
setFieldValue(
|
|
29635
|
+
props.path,
|
|
29636
|
+
"data.gradient.enabled",
|
|
29637
|
+
value === "gradient"
|
|
29638
|
+
);
|
|
29639
|
+
} else {
|
|
29640
|
+
let width = 600;
|
|
29641
|
+
let height = 400;
|
|
29642
|
+
const domNode = ReactEditor.toDOMNode(
|
|
29643
|
+
editor,
|
|
29644
|
+
Node.get(editor, props.path)
|
|
29645
|
+
);
|
|
29646
|
+
try {
|
|
29647
|
+
width = domNode.offsetWidth;
|
|
29648
|
+
height = parseInt((domNode.offsetHeight * 1.5).toString());
|
|
29649
|
+
} catch (error2) {
|
|
29650
|
+
console.log("error", error2);
|
|
29651
|
+
}
|
|
29652
|
+
const gradient = {
|
|
29653
|
+
enabled: true,
|
|
29654
|
+
colors: [
|
|
29655
|
+
{
|
|
29656
|
+
id: nanoid(),
|
|
29657
|
+
color: "#4a90e2",
|
|
29658
|
+
position: 0
|
|
29659
|
+
},
|
|
29660
|
+
{
|
|
29661
|
+
id: nanoid(),
|
|
29662
|
+
color: "#c6dffb",
|
|
29663
|
+
position: 30
|
|
29664
|
+
},
|
|
29665
|
+
{
|
|
29666
|
+
id: nanoid(),
|
|
29667
|
+
color: "#ffffff",
|
|
29668
|
+
position: 100
|
|
29669
|
+
}
|
|
29670
|
+
],
|
|
29671
|
+
angle: 45,
|
|
29672
|
+
type: "linear",
|
|
29673
|
+
width,
|
|
29674
|
+
height
|
|
29675
|
+
};
|
|
29676
|
+
setFieldValue(props.path, "data.gradient", gradient);
|
|
29677
|
+
setFieldValue(
|
|
29678
|
+
props.path,
|
|
29679
|
+
props.name + ".background-url",
|
|
29680
|
+
"https://cdn.shopify.com/s/files/1/0863/8971/9346/files/vt4tumq_4aorkduqi2c-s_nwiysq709yi-nbxh-c8sk.png"
|
|
29681
|
+
);
|
|
29682
|
+
}
|
|
29683
|
+
},
|
|
29684
|
+
[editor, hasGradient, props.name, props.path, setFieldValue]
|
|
29685
|
+
);
|
|
28851
29686
|
return useMemo(() => {
|
|
28852
29687
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
28853
29688
|
AttributeField.SwitchField,
|
|
@@ -28856,7 +29691,52 @@ function BackgroundImage(props) {
|
|
|
28856
29691
|
label: t("Image"),
|
|
28857
29692
|
name: props.name + ".background-image-enabled"
|
|
28858
29693
|
}
|
|
28859
|
-
), isEnabledImage && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
29694
|
+
), isEnabledImage && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, enabledGradientImage && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Grid.Row, null, /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 20, offset: 4 }, /* @__PURE__ */ React__default.createElement(
|
|
29695
|
+
Radio.Group,
|
|
29696
|
+
{
|
|
29697
|
+
type: "button",
|
|
29698
|
+
value: isEnabledGradient ? "gradient" : "image",
|
|
29699
|
+
onChange: handleChangeEnabledGradient,
|
|
29700
|
+
options: [
|
|
29701
|
+
{
|
|
29702
|
+
value: "image",
|
|
29703
|
+
label: /* @__PURE__ */ React__default.createElement(
|
|
29704
|
+
Space,
|
|
29705
|
+
{
|
|
29706
|
+
align: "center",
|
|
29707
|
+
style: {
|
|
29708
|
+
minWidth: "100px",
|
|
29709
|
+
justifyContent: "center"
|
|
29710
|
+
}
|
|
29711
|
+
},
|
|
29712
|
+
/* @__PURE__ */ React__default.createElement(IconImage, null),
|
|
29713
|
+
t("Image")
|
|
29714
|
+
)
|
|
29715
|
+
},
|
|
29716
|
+
{
|
|
29717
|
+
value: "gradient",
|
|
29718
|
+
label: /* @__PURE__ */ React__default.createElement(
|
|
29719
|
+
Space,
|
|
29720
|
+
{
|
|
29721
|
+
align: "center",
|
|
29722
|
+
style: {
|
|
29723
|
+
minWidth: "100px",
|
|
29724
|
+
justifyContent: "center"
|
|
29725
|
+
}
|
|
29726
|
+
},
|
|
29727
|
+
/* @__PURE__ */ React__default.createElement(IconPalette, null),
|
|
29728
|
+
t("Gradient")
|
|
29729
|
+
)
|
|
29730
|
+
}
|
|
29731
|
+
]
|
|
29732
|
+
}
|
|
29733
|
+
))), /* @__PURE__ */ React__default.createElement(Divider$2, null)), isEnabledGradient ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
29734
|
+
AttributeField.BackgroundGradient,
|
|
29735
|
+
__spreadProps(__spreadValues({}, props), {
|
|
29736
|
+
targetName: props.name + ".background-url",
|
|
29737
|
+
formItem: __spreadValues({ layout: "vertical" }, props.formItem)
|
|
29738
|
+
})
|
|
29739
|
+
)) : /* @__PURE__ */ React__default.createElement(
|
|
28860
29740
|
AttributeField.ImageUrl,
|
|
28861
29741
|
__spreadProps(__spreadValues({}, props), {
|
|
28862
29742
|
name: props.name + ".background-url",
|
|
@@ -28876,7 +29756,13 @@ function BackgroundImage(props) {
|
|
|
28876
29756
|
name: props.name + ".background-position"
|
|
28877
29757
|
})
|
|
28878
29758
|
)));
|
|
28879
|
-
}, [
|
|
29759
|
+
}, [
|
|
29760
|
+
enabledGradientImage,
|
|
29761
|
+
handleChangeEnabledGradient,
|
|
29762
|
+
isEnabledGradient,
|
|
29763
|
+
isEnabledImage,
|
|
29764
|
+
props
|
|
29765
|
+
]);
|
|
28880
29766
|
}
|
|
28881
29767
|
function ImageUrl(props) {
|
|
28882
29768
|
const { onUpload } = useEditorProps();
|
|
@@ -29812,19 +30698,19 @@ const options$3 = [
|
|
|
29812
30698
|
{
|
|
29813
30699
|
value: "top",
|
|
29814
30700
|
get label() {
|
|
29815
|
-
return t("
|
|
30701
|
+
return t("Top");
|
|
29816
30702
|
}
|
|
29817
30703
|
},
|
|
29818
30704
|
{
|
|
29819
30705
|
value: "middle",
|
|
29820
30706
|
get label() {
|
|
29821
|
-
return t("
|
|
30707
|
+
return t("Middle");
|
|
29822
30708
|
}
|
|
29823
30709
|
},
|
|
29824
30710
|
{
|
|
29825
30711
|
value: "bottom",
|
|
29826
30712
|
get label() {
|
|
29827
|
-
return t("
|
|
30713
|
+
return t("Bottom");
|
|
29828
30714
|
}
|
|
29829
30715
|
}
|
|
29830
30716
|
];
|
|
@@ -29929,41 +30815,56 @@ function PixelAndPercentField(props) {
|
|
|
29929
30815
|
return val + unit;
|
|
29930
30816
|
}
|
|
29931
30817
|
};
|
|
29932
|
-
return /* @__PURE__ */ React__default.createElement(Grid.Row,
|
|
29933
|
-
|
|
29934
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
29935
|
-
label,
|
|
29936
|
-
formItem: __spreadValues(__spreadProps(__spreadValues({}, adapter), {
|
|
29937
|
-
disabled: props.disabled,
|
|
29938
|
-
labelCol: {
|
|
29939
|
-
span: 10,
|
|
29940
|
-
offset: 2
|
|
29941
|
-
},
|
|
29942
|
-
wrapperCol: {
|
|
29943
|
-
span: 12
|
|
29944
|
-
}
|
|
29945
|
-
}), props.formItem)
|
|
29946
|
-
})
|
|
29947
|
-
)), /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 6 }, /* @__PURE__ */ React__default.createElement(
|
|
29948
|
-
Form.Item,
|
|
30818
|
+
return /* @__PURE__ */ React__default.createElement(Grid.Row, { className: "easy-email-pro-theme-PixelAndPercentField" }, /* @__PURE__ */ React__default.createElement(
|
|
30819
|
+
Grid.Col,
|
|
29949
30820
|
{
|
|
29950
|
-
|
|
29951
|
-
|
|
29952
|
-
|
|
29953
|
-
},
|
|
29954
|
-
wrapperCol: { span: 24 }
|
|
30821
|
+
className: "easy-email-pro-theme-PixelAndPercentField-number",
|
|
30822
|
+
span: 16,
|
|
30823
|
+
style: { textAlign: "right" }
|
|
29955
30824
|
},
|
|
29956
30825
|
/* @__PURE__ */ React__default.createElement(
|
|
29957
|
-
|
|
30826
|
+
AttributeField.NumberField,
|
|
30827
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
30828
|
+
label,
|
|
30829
|
+
formItem: __spreadValues(__spreadProps(__spreadValues({}, adapter), {
|
|
30830
|
+
disabled: props.disabled,
|
|
30831
|
+
labelCol: {
|
|
30832
|
+
span: 10,
|
|
30833
|
+
offset: 2
|
|
30834
|
+
},
|
|
30835
|
+
wrapperCol: {
|
|
30836
|
+
span: 12
|
|
30837
|
+
}
|
|
30838
|
+
}), props.formItem)
|
|
30839
|
+
})
|
|
30840
|
+
)
|
|
30841
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
30842
|
+
Grid.Col,
|
|
30843
|
+
{
|
|
30844
|
+
className: "easy-email-pro-theme-PixelAndPercentField-unit",
|
|
30845
|
+
span: 6
|
|
30846
|
+
},
|
|
30847
|
+
/* @__PURE__ */ React__default.createElement(
|
|
30848
|
+
Form.Item,
|
|
29958
30849
|
{
|
|
29959
|
-
|
|
29960
|
-
|
|
29961
|
-
|
|
30850
|
+
labelCol: {
|
|
30851
|
+
span: 0,
|
|
30852
|
+
style: { lineHeight: 1.15 }
|
|
30853
|
+
},
|
|
30854
|
+
wrapperCol: { span: 24 }
|
|
29962
30855
|
},
|
|
29963
|
-
/* @__PURE__ */ React__default.createElement(
|
|
29964
|
-
|
|
30856
|
+
/* @__PURE__ */ React__default.createElement(
|
|
30857
|
+
Select$1,
|
|
30858
|
+
{
|
|
30859
|
+
disabled: props.disabled,
|
|
30860
|
+
value: unit,
|
|
30861
|
+
onChange: onChangeUnit
|
|
30862
|
+
},
|
|
30863
|
+
/* @__PURE__ */ React__default.createElement(Select$1.Option, { value: "px" }, t("px")),
|
|
30864
|
+
/* @__PURE__ */ React__default.createElement(Select$1.Option, { value: "" }, t("%"))
|
|
30865
|
+
)
|
|
29965
30866
|
)
|
|
29966
|
-
))
|
|
30867
|
+
));
|
|
29967
30868
|
}, [label, onChangeUnit, props.disabled, props.formItem, rest, unit]);
|
|
29968
30869
|
}
|
|
29969
30870
|
function ImageWidth(props) {
|
|
@@ -30052,7 +30953,7 @@ function Direction(props) {
|
|
|
30052
30953
|
}, rest), {
|
|
30053
30954
|
formItem: __spreadProps(__spreadValues({}, rest.formItem), {
|
|
30054
30955
|
wrapperCol: __spreadProps(__spreadValues({}, (_a2 = rest.formItem) == null ? void 0 : _a2.wrapperCol), {
|
|
30055
|
-
span:
|
|
30956
|
+
span: 14
|
|
30056
30957
|
})
|
|
30057
30958
|
})
|
|
30058
30959
|
})
|
|
@@ -30237,6 +31138,76 @@ const MergeTagSelectInputField = (props) => {
|
|
|
30237
31138
|
))
|
|
30238
31139
|
));
|
|
30239
31140
|
};
|
|
31141
|
+
function BackgroundGradient(props) {
|
|
31142
|
+
const { onUpload } = useEditorProps();
|
|
31143
|
+
const { getFieldValue, setFieldValue } = useEditorContext();
|
|
31144
|
+
const editor = useSlateStatic();
|
|
31145
|
+
const fieldName = "data.gradient";
|
|
31146
|
+
const gradient = useEqualState(getFieldValue(props.path, fieldName));
|
|
31147
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
31148
|
+
const handelSave = useCallback(
|
|
31149
|
+
(val, blob) => __async(this, null, function* () {
|
|
31150
|
+
if (!onUpload)
|
|
31151
|
+
return;
|
|
31152
|
+
const gradientUrl = yield onUpload(blob);
|
|
31153
|
+
setFieldValue(props.path, props.targetName, gradientUrl);
|
|
31154
|
+
}),
|
|
31155
|
+
[onUpload, props.path, props.targetName, setFieldValue]
|
|
31156
|
+
);
|
|
31157
|
+
const handelPreview = useCallback(
|
|
31158
|
+
(url) => {
|
|
31159
|
+
HistoryEditor.withoutSaving(editor, () => {
|
|
31160
|
+
setFieldValue(props.path, props.targetName, url);
|
|
31161
|
+
});
|
|
31162
|
+
},
|
|
31163
|
+
[editor, props.path, props.targetName, setFieldValue]
|
|
31164
|
+
);
|
|
31165
|
+
const handleChange = useCallback(
|
|
31166
|
+
(val) => {
|
|
31167
|
+
setFieldValue(props.path, fieldName, val);
|
|
31168
|
+
},
|
|
31169
|
+
[props.path, fieldName, setFieldValue]
|
|
31170
|
+
);
|
|
31171
|
+
const enableGradient = useEqualState(
|
|
31172
|
+
getFieldValue(props.path, `${fieldName}.enabled`)
|
|
31173
|
+
);
|
|
31174
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isOpen && /* @__PURE__ */ React__default.createElement(
|
|
31175
|
+
GradientGenerator,
|
|
31176
|
+
{
|
|
31177
|
+
data: gradient,
|
|
31178
|
+
onSave: handelSave,
|
|
31179
|
+
onPreview: handelPreview,
|
|
31180
|
+
onChange: handleChange,
|
|
31181
|
+
enable: enableGradient,
|
|
31182
|
+
isOpen,
|
|
31183
|
+
setIsOpen
|
|
31184
|
+
}
|
|
31185
|
+
), /* @__PURE__ */ React__default.createElement(Form.Item, { wrapperCol: { offset: 8, span: 14 } }, /* @__PURE__ */ React__default.createElement(
|
|
31186
|
+
Button$2,
|
|
31187
|
+
{
|
|
31188
|
+
onClick: () => setIsOpen(true),
|
|
31189
|
+
type: "primary",
|
|
31190
|
+
size: "large",
|
|
31191
|
+
icon: /* @__PURE__ */ React__default.createElement(IconPalette, null),
|
|
31192
|
+
style: {
|
|
31193
|
+
width: "100%",
|
|
31194
|
+
border: "none",
|
|
31195
|
+
borderRadius: "6px",
|
|
31196
|
+
fontWeight: "500",
|
|
31197
|
+
background: "linear-gradient(to right, #9333ea, #db2777)",
|
|
31198
|
+
transition: "background 0.3s ease",
|
|
31199
|
+
marginBottom: "10px"
|
|
31200
|
+
},
|
|
31201
|
+
onMouseEnter: (e) => {
|
|
31202
|
+
e.currentTarget.style.background = "linear-gradient(to right, #7e22ce, #be185d)";
|
|
31203
|
+
},
|
|
31204
|
+
onMouseLeave: (e) => {
|
|
31205
|
+
e.currentTarget.style.background = "linear-gradient(to right, #9333ea, #db2777)";
|
|
31206
|
+
}
|
|
31207
|
+
},
|
|
31208
|
+
t("Create gradient")
|
|
31209
|
+
)));
|
|
31210
|
+
}
|
|
30240
31211
|
const defaultAttributeFields = {
|
|
30241
31212
|
// Basic Form Field
|
|
30242
31213
|
WatchField,
|
|
@@ -30264,6 +31235,7 @@ const defaultAttributeFields = {
|
|
|
30264
31235
|
TextAreaField,
|
|
30265
31236
|
Link: Link$2,
|
|
30266
31237
|
BackgroundImage,
|
|
31238
|
+
BackgroundGradient,
|
|
30267
31239
|
DisplayOptions,
|
|
30268
31240
|
Columns,
|
|
30269
31241
|
BackgroundColor,
|
|
@@ -30292,7 +31264,8 @@ const defaultAttributeFields = {
|
|
|
30292
31264
|
ButtonCategory,
|
|
30293
31265
|
WebFonts,
|
|
30294
31266
|
RichTextField,
|
|
30295
|
-
FieldItem
|
|
31267
|
+
FieldItem,
|
|
31268
|
+
GradientGeneratorField
|
|
30296
31269
|
};
|
|
30297
31270
|
const AttributeField = __spreadValues({}, defaultAttributeFields);
|
|
30298
31271
|
const index$5 = "";
|