@kgalexander/mcreate 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-B46UUREH.mjs → chunk-R3LRNUKL.mjs} +28 -15
- package/dist/{core-FWDS3AQF.mjs → core-HIQH4BAG.mjs} +1 -1
- package/dist/index.d.mts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +276 -72
- package/dist/index.mjs +252 -59
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
Tooltip,
|
|
49
49
|
TooltipContent,
|
|
50
50
|
TooltipTrigger,
|
|
51
|
+
campaign_validation_warnings,
|
|
51
52
|
cn,
|
|
52
53
|
formatBorder,
|
|
53
54
|
getElementDisplayName,
|
|
@@ -59,8 +60,10 @@ import {
|
|
|
59
60
|
parsePrice,
|
|
60
61
|
setupDragImage,
|
|
61
62
|
useEditorStore,
|
|
62
|
-
useSidebarContext
|
|
63
|
-
|
|
63
|
+
useSidebarContext,
|
|
64
|
+
validate_campaign_onCreate,
|
|
65
|
+
validate_editor_onPreview
|
|
66
|
+
} from "./chunk-R3LRNUKL.mjs";
|
|
64
67
|
|
|
65
68
|
// src/core/editor/components/email-template-v2/header.tsx
|
|
66
69
|
import { ArrowLeftIcon, CopyIcon, MegaphoneIcon, MoreHorizontalIcon, PencilIcon, SendIcon, TrashIcon } from "lucide-react";
|
|
@@ -256,19 +259,23 @@ function TemplateHeader() {
|
|
|
256
259
|
if (isSaving || !templateId || !onSave) return;
|
|
257
260
|
setIsSaving(true);
|
|
258
261
|
try {
|
|
262
|
+
const PLACEHOLDER_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mN88P/BfwAJhAPkD+pMGAAAAABJRU5ErkJggg==";
|
|
259
263
|
const template = useEditorStore.getState().template;
|
|
264
|
+
const needsCapture = useEditorStore.getState().hasUnsavedChanges() || !template.image || template.image === PLACEHOLDER_IMAGE;
|
|
260
265
|
let capturedImage;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
if (needsCapture) {
|
|
267
|
+
try {
|
|
268
|
+
const { default: mjml2html } = await import("mjml-browser");
|
|
269
|
+
const mjmlString = json2mjml(template, "editing");
|
|
270
|
+
const result = mjml2html(mjmlString);
|
|
271
|
+
capturedImage = await captureTemplateImage(result.html);
|
|
272
|
+
} catch (err) {
|
|
273
|
+
console.error("[TemplateCapture] Failed:", err?.message || JSON.stringify(err) || err, err?.stack || "");
|
|
274
|
+
}
|
|
268
275
|
}
|
|
269
276
|
await onSave(templateId, template, capturedImage);
|
|
270
|
-
markAsSaved();
|
|
271
277
|
onExit?.();
|
|
278
|
+
markAsSaved();
|
|
272
279
|
} catch (error) {
|
|
273
280
|
console.error("Failed to save:", error);
|
|
274
281
|
} finally {
|
|
@@ -2757,7 +2764,7 @@ function useTemplateColors() {
|
|
|
2757
2764
|
return useMemo3(() => getTemplateColors(template), [template]);
|
|
2758
2765
|
}
|
|
2759
2766
|
|
|
2760
|
-
// node_modules/color-name/index.js
|
|
2767
|
+
// node_modules/color-string/node_modules/color-name/index.js
|
|
2761
2768
|
var colors = {
|
|
2762
2769
|
aliceblue: [240, 248, 255],
|
|
2763
2770
|
antiquewhite: [250, 235, 215],
|
|
@@ -3079,10 +3086,164 @@ function hexDouble(number_) {
|
|
|
3079
3086
|
}
|
|
3080
3087
|
var color_string_default = cs;
|
|
3081
3088
|
|
|
3082
|
-
// node_modules/color-
|
|
3089
|
+
// node_modules/color/node_modules/color-name/index.js
|
|
3090
|
+
var colors2 = {
|
|
3091
|
+
aliceblue: [240, 248, 255],
|
|
3092
|
+
antiquewhite: [250, 235, 215],
|
|
3093
|
+
aqua: [0, 255, 255],
|
|
3094
|
+
aquamarine: [127, 255, 212],
|
|
3095
|
+
azure: [240, 255, 255],
|
|
3096
|
+
beige: [245, 245, 220],
|
|
3097
|
+
bisque: [255, 228, 196],
|
|
3098
|
+
black: [0, 0, 0],
|
|
3099
|
+
blanchedalmond: [255, 235, 205],
|
|
3100
|
+
blue: [0, 0, 255],
|
|
3101
|
+
blueviolet: [138, 43, 226],
|
|
3102
|
+
brown: [165, 42, 42],
|
|
3103
|
+
burlywood: [222, 184, 135],
|
|
3104
|
+
cadetblue: [95, 158, 160],
|
|
3105
|
+
chartreuse: [127, 255, 0],
|
|
3106
|
+
chocolate: [210, 105, 30],
|
|
3107
|
+
coral: [255, 127, 80],
|
|
3108
|
+
cornflowerblue: [100, 149, 237],
|
|
3109
|
+
cornsilk: [255, 248, 220],
|
|
3110
|
+
crimson: [220, 20, 60],
|
|
3111
|
+
cyan: [0, 255, 255],
|
|
3112
|
+
darkblue: [0, 0, 139],
|
|
3113
|
+
darkcyan: [0, 139, 139],
|
|
3114
|
+
darkgoldenrod: [184, 134, 11],
|
|
3115
|
+
darkgray: [169, 169, 169],
|
|
3116
|
+
darkgreen: [0, 100, 0],
|
|
3117
|
+
darkgrey: [169, 169, 169],
|
|
3118
|
+
darkkhaki: [189, 183, 107],
|
|
3119
|
+
darkmagenta: [139, 0, 139],
|
|
3120
|
+
darkolivegreen: [85, 107, 47],
|
|
3121
|
+
darkorange: [255, 140, 0],
|
|
3122
|
+
darkorchid: [153, 50, 204],
|
|
3123
|
+
darkred: [139, 0, 0],
|
|
3124
|
+
darksalmon: [233, 150, 122],
|
|
3125
|
+
darkseagreen: [143, 188, 143],
|
|
3126
|
+
darkslateblue: [72, 61, 139],
|
|
3127
|
+
darkslategray: [47, 79, 79],
|
|
3128
|
+
darkslategrey: [47, 79, 79],
|
|
3129
|
+
darkturquoise: [0, 206, 209],
|
|
3130
|
+
darkviolet: [148, 0, 211],
|
|
3131
|
+
deeppink: [255, 20, 147],
|
|
3132
|
+
deepskyblue: [0, 191, 255],
|
|
3133
|
+
dimgray: [105, 105, 105],
|
|
3134
|
+
dimgrey: [105, 105, 105],
|
|
3135
|
+
dodgerblue: [30, 144, 255],
|
|
3136
|
+
firebrick: [178, 34, 34],
|
|
3137
|
+
floralwhite: [255, 250, 240],
|
|
3138
|
+
forestgreen: [34, 139, 34],
|
|
3139
|
+
fuchsia: [255, 0, 255],
|
|
3140
|
+
gainsboro: [220, 220, 220],
|
|
3141
|
+
ghostwhite: [248, 248, 255],
|
|
3142
|
+
gold: [255, 215, 0],
|
|
3143
|
+
goldenrod: [218, 165, 32],
|
|
3144
|
+
gray: [128, 128, 128],
|
|
3145
|
+
green: [0, 128, 0],
|
|
3146
|
+
greenyellow: [173, 255, 47],
|
|
3147
|
+
grey: [128, 128, 128],
|
|
3148
|
+
honeydew: [240, 255, 240],
|
|
3149
|
+
hotpink: [255, 105, 180],
|
|
3150
|
+
indianred: [205, 92, 92],
|
|
3151
|
+
indigo: [75, 0, 130],
|
|
3152
|
+
ivory: [255, 255, 240],
|
|
3153
|
+
khaki: [240, 230, 140],
|
|
3154
|
+
lavender: [230, 230, 250],
|
|
3155
|
+
lavenderblush: [255, 240, 245],
|
|
3156
|
+
lawngreen: [124, 252, 0],
|
|
3157
|
+
lemonchiffon: [255, 250, 205],
|
|
3158
|
+
lightblue: [173, 216, 230],
|
|
3159
|
+
lightcoral: [240, 128, 128],
|
|
3160
|
+
lightcyan: [224, 255, 255],
|
|
3161
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
3162
|
+
lightgray: [211, 211, 211],
|
|
3163
|
+
lightgreen: [144, 238, 144],
|
|
3164
|
+
lightgrey: [211, 211, 211],
|
|
3165
|
+
lightpink: [255, 182, 193],
|
|
3166
|
+
lightsalmon: [255, 160, 122],
|
|
3167
|
+
lightseagreen: [32, 178, 170],
|
|
3168
|
+
lightskyblue: [135, 206, 250],
|
|
3169
|
+
lightslategray: [119, 136, 153],
|
|
3170
|
+
lightslategrey: [119, 136, 153],
|
|
3171
|
+
lightsteelblue: [176, 196, 222],
|
|
3172
|
+
lightyellow: [255, 255, 224],
|
|
3173
|
+
lime: [0, 255, 0],
|
|
3174
|
+
limegreen: [50, 205, 50],
|
|
3175
|
+
linen: [250, 240, 230],
|
|
3176
|
+
magenta: [255, 0, 255],
|
|
3177
|
+
maroon: [128, 0, 0],
|
|
3178
|
+
mediumaquamarine: [102, 205, 170],
|
|
3179
|
+
mediumblue: [0, 0, 205],
|
|
3180
|
+
mediumorchid: [186, 85, 211],
|
|
3181
|
+
mediumpurple: [147, 112, 219],
|
|
3182
|
+
mediumseagreen: [60, 179, 113],
|
|
3183
|
+
mediumslateblue: [123, 104, 238],
|
|
3184
|
+
mediumspringgreen: [0, 250, 154],
|
|
3185
|
+
mediumturquoise: [72, 209, 204],
|
|
3186
|
+
mediumvioletred: [199, 21, 133],
|
|
3187
|
+
midnightblue: [25, 25, 112],
|
|
3188
|
+
mintcream: [245, 255, 250],
|
|
3189
|
+
mistyrose: [255, 228, 225],
|
|
3190
|
+
moccasin: [255, 228, 181],
|
|
3191
|
+
navajowhite: [255, 222, 173],
|
|
3192
|
+
navy: [0, 0, 128],
|
|
3193
|
+
oldlace: [253, 245, 230],
|
|
3194
|
+
olive: [128, 128, 0],
|
|
3195
|
+
olivedrab: [107, 142, 35],
|
|
3196
|
+
orange: [255, 165, 0],
|
|
3197
|
+
orangered: [255, 69, 0],
|
|
3198
|
+
orchid: [218, 112, 214],
|
|
3199
|
+
palegoldenrod: [238, 232, 170],
|
|
3200
|
+
palegreen: [152, 251, 152],
|
|
3201
|
+
paleturquoise: [175, 238, 238],
|
|
3202
|
+
palevioletred: [219, 112, 147],
|
|
3203
|
+
papayawhip: [255, 239, 213],
|
|
3204
|
+
peachpuff: [255, 218, 185],
|
|
3205
|
+
peru: [205, 133, 63],
|
|
3206
|
+
pink: [255, 192, 203],
|
|
3207
|
+
plum: [221, 160, 221],
|
|
3208
|
+
powderblue: [176, 224, 230],
|
|
3209
|
+
purple: [128, 0, 128],
|
|
3210
|
+
rebeccapurple: [102, 51, 153],
|
|
3211
|
+
red: [255, 0, 0],
|
|
3212
|
+
rosybrown: [188, 143, 143],
|
|
3213
|
+
royalblue: [65, 105, 225],
|
|
3214
|
+
saddlebrown: [139, 69, 19],
|
|
3215
|
+
salmon: [250, 128, 114],
|
|
3216
|
+
sandybrown: [244, 164, 96],
|
|
3217
|
+
seagreen: [46, 139, 87],
|
|
3218
|
+
seashell: [255, 245, 238],
|
|
3219
|
+
sienna: [160, 82, 45],
|
|
3220
|
+
silver: [192, 192, 192],
|
|
3221
|
+
skyblue: [135, 206, 235],
|
|
3222
|
+
slateblue: [106, 90, 205],
|
|
3223
|
+
slategray: [112, 128, 144],
|
|
3224
|
+
slategrey: [112, 128, 144],
|
|
3225
|
+
snow: [255, 250, 250],
|
|
3226
|
+
springgreen: [0, 255, 127],
|
|
3227
|
+
steelblue: [70, 130, 180],
|
|
3228
|
+
tan: [210, 180, 140],
|
|
3229
|
+
teal: [0, 128, 128],
|
|
3230
|
+
thistle: [216, 191, 216],
|
|
3231
|
+
tomato: [255, 99, 71],
|
|
3232
|
+
turquoise: [64, 224, 208],
|
|
3233
|
+
violet: [238, 130, 238],
|
|
3234
|
+
wheat: [245, 222, 179],
|
|
3235
|
+
white: [255, 255, 255],
|
|
3236
|
+
whitesmoke: [245, 245, 245],
|
|
3237
|
+
yellow: [255, 255, 0],
|
|
3238
|
+
yellowgreen: [154, 205, 50]
|
|
3239
|
+
};
|
|
3240
|
+
for (const key in colors2) Object.freeze(colors2[key]);
|
|
3241
|
+
var color_name_default2 = Object.freeze(colors2);
|
|
3242
|
+
|
|
3243
|
+
// node_modules/color/node_modules/color-convert/conversions.js
|
|
3083
3244
|
var reverseKeywords = {};
|
|
3084
|
-
for (const key of Object.keys(
|
|
3085
|
-
reverseKeywords[
|
|
3245
|
+
for (const key of Object.keys(color_name_default2)) {
|
|
3246
|
+
reverseKeywords[color_name_default2[key]] = key;
|
|
3086
3247
|
}
|
|
3087
3248
|
var convert = {
|
|
3088
3249
|
rgb: { channels: 3, labels: "rgb" },
|
|
@@ -3258,8 +3419,8 @@ convert.rgb.keyword = function(rgb) {
|
|
|
3258
3419
|
}
|
|
3259
3420
|
let currentClosestDistance = Number.POSITIVE_INFINITY;
|
|
3260
3421
|
let currentClosestKeyword;
|
|
3261
|
-
for (const keyword of Object.keys(
|
|
3262
|
-
const value =
|
|
3422
|
+
for (const keyword of Object.keys(color_name_default2)) {
|
|
3423
|
+
const value = color_name_default2[keyword];
|
|
3263
3424
|
const distance = comparativeDistance(rgb, value);
|
|
3264
3425
|
if (distance < currentClosestDistance) {
|
|
3265
3426
|
currentClosestDistance = distance;
|
|
@@ -3269,7 +3430,7 @@ convert.rgb.keyword = function(rgb) {
|
|
|
3269
3430
|
return currentClosestKeyword;
|
|
3270
3431
|
};
|
|
3271
3432
|
convert.keyword.rgb = function(keyword) {
|
|
3272
|
-
return [...
|
|
3433
|
+
return [...color_name_default2[keyword]];
|
|
3273
3434
|
};
|
|
3274
3435
|
convert.rgb.xyz = function(rgb) {
|
|
3275
3436
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
@@ -3827,7 +3988,7 @@ convert.rgb.gray = function(rgb) {
|
|
|
3827
3988
|
return [value / 255 * 100];
|
|
3828
3989
|
};
|
|
3829
3990
|
|
|
3830
|
-
// node_modules/color-convert/route.js
|
|
3991
|
+
// node_modules/color/node_modules/color-convert/route.js
|
|
3831
3992
|
function buildGraph() {
|
|
3832
3993
|
const graph = {};
|
|
3833
3994
|
const models2 = Object.keys(conversions_default);
|
|
@@ -3893,7 +4054,7 @@ function route(fromModel) {
|
|
|
3893
4054
|
}
|
|
3894
4055
|
var route_default = route;
|
|
3895
4056
|
|
|
3896
|
-
// node_modules/color-convert/index.js
|
|
4057
|
+
// node_modules/color/node_modules/color-convert/index.js
|
|
3897
4058
|
var convert2 = {};
|
|
3898
4059
|
var models = Object.keys(conversions_default);
|
|
3899
4060
|
function wrapRaw(fn) {
|
|
@@ -4536,7 +4697,7 @@ var ColorPickerEyeDropper = ({ className, ...props }) => {
|
|
|
4536
4697
|
return /* @__PURE__ */ jsx25(
|
|
4537
4698
|
Button,
|
|
4538
4699
|
{
|
|
4539
|
-
className: cn("shrink-0 text-muted-foreground", className),
|
|
4700
|
+
className: cn("shrink-0 text-muted-foreground shadow-none", className),
|
|
4540
4701
|
onClick: handleEyeDropper,
|
|
4541
4702
|
size: "icon",
|
|
4542
4703
|
type: "button",
|
|
@@ -4568,26 +4729,23 @@ var ColorPickerFormat = ({ className, ...props }) => {
|
|
|
4568
4729
|
const color = color_default.hsl(hue, saturation, lightness, alpha / 100);
|
|
4569
4730
|
if (mode === "hex") {
|
|
4570
4731
|
const hex = color.hex();
|
|
4571
|
-
return /* @__PURE__ */
|
|
4732
|
+
return /* @__PURE__ */ jsx25(
|
|
4572
4733
|
"div",
|
|
4573
4734
|
{
|
|
4574
4735
|
className: cn(
|
|
4575
|
-
"-space-x-px relative flex w-full items-center rounded-
|
|
4736
|
+
"-space-x-px relative flex w-full items-center rounded-[12px] shadow-none",
|
|
4576
4737
|
className
|
|
4577
4738
|
),
|
|
4578
4739
|
...props,
|
|
4579
|
-
children:
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
),
|
|
4589
|
-
/* @__PURE__ */ jsx25(PercentageInput, { value: alpha })
|
|
4590
|
-
]
|
|
4740
|
+
children: /* @__PURE__ */ jsx25(
|
|
4741
|
+
Input,
|
|
4742
|
+
{
|
|
4743
|
+
className: "h-[32px] py-0 pr-10 bg-accent dark:bg-accent border-border placeholder:text-muted-foreground rounded-[12px] shadow-none w-full",
|
|
4744
|
+
readOnly: true,
|
|
4745
|
+
type: "text",
|
|
4746
|
+
value: hex
|
|
4747
|
+
}
|
|
4748
|
+
)
|
|
4591
4749
|
}
|
|
4592
4750
|
);
|
|
4593
4751
|
}
|
|
@@ -4723,7 +4881,8 @@ var TRANSPARENT_ALLOWED_ELEMENTS = [
|
|
|
4723
4881
|
"socialBgColor",
|
|
4724
4882
|
"buttonBgColor",
|
|
4725
4883
|
"highlightColor",
|
|
4726
|
-
"propertyBgColor"
|
|
4884
|
+
"propertyBgColor",
|
|
4885
|
+
"dividerBgColor"
|
|
4727
4886
|
];
|
|
4728
4887
|
var rgbToHex2 = (rgb) => {
|
|
4729
4888
|
const match = rgb.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/i);
|
|
@@ -4815,14 +4974,11 @@ function ColorSelection({ setActiveView, lastView, onColorSelect, colorType = "C
|
|
|
4815
4974
|
] }) })
|
|
4816
4975
|
] }),
|
|
4817
4976
|
colorPalettes.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "w-full mb-4", children: [
|
|
4818
|
-
/* @__PURE__ */
|
|
4819
|
-
/* @__PURE__ */
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
/* @__PURE__ */ jsx26(Button, { variant: "link", className: "text-sm pr-0 cursor-pointer", children: "Edit" })
|
|
4824
|
-
] }),
|
|
4825
|
-
/* @__PURE__ */ jsx26("div", { className: "w-full flex flex-col gap-4", children: colorPalettes.map((palette) => /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-2", children: [
|
|
4977
|
+
/* @__PURE__ */ jsx26("div", { className: "flex flex-row items-center justify-between w-full mb-1", children: /* @__PURE__ */ jsxs24("div", { className: "flex flex-row items-center gap-2 h-[44px]", children: [
|
|
4978
|
+
/* @__PURE__ */ jsx26(Hexagon, { className: "w-4 h-4 text-muted-foreground" }),
|
|
4979
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium", children: "Brand colors" })
|
|
4980
|
+
] }) }),
|
|
4981
|
+
/* @__PURE__ */ jsx26("div", { className: "w-full flex flex-col gap-4", children: colorPalettes.map((palette) => palette.colors.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-2", children: [
|
|
4826
4982
|
/* @__PURE__ */ jsx26(Label, { className: "text-xs font-medium text-muted-foreground", children: palette.name }),
|
|
4827
4983
|
/* @__PURE__ */ jsx26("div", { className: "w-full grid grid-cols-7 gap-2", children: palette.colors.map((c) => /* @__PURE__ */ jsx26(ColorButton, { colorName: c.name, color: c.hex, onColorSelect, currentColor }, c.color_id)) })
|
|
4828
4984
|
] }, palette.palette_id)) })
|
|
@@ -5884,7 +6040,7 @@ function ParentBreadcrumb() {
|
|
|
5884
6040
|
/* @__PURE__ */ jsx31(BreadcrumbItem, { children: /* @__PURE__ */ jsxs29(Tooltip, { children: [
|
|
5885
6041
|
/* @__PURE__ */ jsx31(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs29("div", { className: "relative", children: [
|
|
5886
6042
|
/* @__PURE__ */ jsx31(Button, { variant: "ghost", disabled: true, className: "p-0 px-1.5 shadow-none transition-none cursor-pointer", children: currentName }),
|
|
5887
|
-
/* @__PURE__ */ jsx31("div", { className: "absolute right-0 top-0 bottom-0 w-[50%] bg-gradient-to-r from-transparent to-
|
|
6043
|
+
/* @__PURE__ */ jsx31("div", { className: "absolute right-0 top-0 bottom-0 w-[50%] bg-gradient-to-r from-transparent to-background pointer-events-none" })
|
|
5888
6044
|
] }) }),
|
|
5889
6045
|
/* @__PURE__ */ jsx31(TooltipContent, { side: "bottom", className: "z-51", children: currentName })
|
|
5890
6046
|
] }) })
|
|
@@ -6475,7 +6631,7 @@ var FontSizeControl = memo3(function FontSizeControl2({
|
|
|
6475
6631
|
Button,
|
|
6476
6632
|
{
|
|
6477
6633
|
variant: "ghost",
|
|
6478
|
-
className: "shadow-none transition-none cursor-pointer bg-transparent border border-r-0 rounded-[12px]",
|
|
6634
|
+
className: "shadow-none transition-none cursor-pointer bg-transparent border border-border border-r-0 rounded-[12px]",
|
|
6479
6635
|
size: "icon",
|
|
6480
6636
|
"aria-label": "Decrease Font Size",
|
|
6481
6637
|
onClick: handleDecrease,
|
|
@@ -6491,7 +6647,7 @@ var FontSizeControl = memo3(function FontSizeControl2({
|
|
|
6491
6647
|
InputGroupInput,
|
|
6492
6648
|
{
|
|
6493
6649
|
type: "number",
|
|
6494
|
-
className: "text-center w-12 border-0 shadow-none px-0",
|
|
6650
|
+
className: "text-center w-12 border-0 shadow-none px-0 bg-background",
|
|
6495
6651
|
placeholder: "--",
|
|
6496
6652
|
value: input.displayValue,
|
|
6497
6653
|
onChange: (e) => input.setLocalValue(e.target.value),
|
|
@@ -6535,7 +6691,7 @@ var FontSizeControl = memo3(function FontSizeControl2({
|
|
|
6535
6691
|
Button,
|
|
6536
6692
|
{
|
|
6537
6693
|
variant: "ghost",
|
|
6538
|
-
className: "shadow-none transition-none cursor-pointer bg-transparent border border-l-0 rounded-[12px]",
|
|
6694
|
+
className: "shadow-none transition-none cursor-pointer bg-transparent border border-border border-l-0 rounded-[12px]",
|
|
6539
6695
|
size: "icon",
|
|
6540
6696
|
"aria-label": "Increase Font Size",
|
|
6541
6697
|
onClick: handleIncrease,
|
|
@@ -7231,6 +7387,15 @@ var parseFontSize = (value) => {
|
|
|
7231
7387
|
// src/core/editor/components/element-gear/text/toolbar.tsx
|
|
7232
7388
|
import { Fragment as Fragment4, jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7233
7389
|
var ALIGNMENTS = ["left", "center", "right", "justify"];
|
|
7390
|
+
var TEXT_TYPE_TO_BRAND_FONT = {
|
|
7391
|
+
h1: "heading",
|
|
7392
|
+
h2: "subheading",
|
|
7393
|
+
h3: "subheading",
|
|
7394
|
+
paragraph: "body",
|
|
7395
|
+
list: "body",
|
|
7396
|
+
"numbered-list": "body",
|
|
7397
|
+
ordered: "body"
|
|
7398
|
+
};
|
|
7234
7399
|
var HEADING_MULTIPLIERS = {
|
|
7235
7400
|
paragraph: 1,
|
|
7236
7401
|
h1: 2,
|
|
@@ -7250,7 +7415,16 @@ var TextToolbar = () => {
|
|
|
7250
7415
|
const textEditingStyles = useEditorStore((s) => s.textEditing?.styles);
|
|
7251
7416
|
const template = useEditorStore((s) => s.template);
|
|
7252
7417
|
const mergeFields = useEditorStore((s) => s.mergeFields);
|
|
7418
|
+
const userData = useEditorStore((s) => s.userData);
|
|
7253
7419
|
const { activeView, colorTarget, setActiveView, setColorType, setColorTarget } = useSidebarContext();
|
|
7420
|
+
const brandFonts = useMemo14(() => {
|
|
7421
|
+
const fonts = userData?.brand_kits?.[0]?.fonts ?? [];
|
|
7422
|
+
const map = {};
|
|
7423
|
+
for (const f of fonts) {
|
|
7424
|
+
map[f.type] = f;
|
|
7425
|
+
}
|
|
7426
|
+
return map;
|
|
7427
|
+
}, [userData]);
|
|
7254
7428
|
const [updateCounter, forceUpdate] = useState17(0);
|
|
7255
7429
|
const [overflowOpen, setOverflowOpen] = useState17(false);
|
|
7256
7430
|
const isInSectionColumn = useMemo14(() => {
|
|
@@ -7374,8 +7548,28 @@ var TextToolbar = () => {
|
|
|
7374
7548
|
};
|
|
7375
7549
|
const level = levelMap[type];
|
|
7376
7550
|
tiptapEditor.chain().focus().setHeadingLevel(level).run();
|
|
7551
|
+
const brandFontType = TEXT_TYPE_TO_BRAND_FONT[type];
|
|
7552
|
+
const brandFont = brandFontType ? brandFonts[brandFontType] : null;
|
|
7553
|
+
if (brandFont) {
|
|
7554
|
+
const { from, to } = tiptapEditor.state.selection;
|
|
7555
|
+
const $from = tiptapEditor.state.doc.resolve(from);
|
|
7556
|
+
const paragraphStart = $from.start($from.depth);
|
|
7557
|
+
const paragraphEnd = $from.end($from.depth);
|
|
7558
|
+
let chain = tiptapEditor.chain().setTextSelection({ from: paragraphStart, to: paragraphEnd }).setFontFamily(brandFont.family).setFontSize(`${brandFont.size}px`);
|
|
7559
|
+
if (level > 0 && !brandFont.isBold) {
|
|
7560
|
+
chain = chain.unsetMark("bold");
|
|
7561
|
+
} else if (level === 0 && brandFont.isBold) {
|
|
7562
|
+
chain = chain.setMark("bold");
|
|
7563
|
+
}
|
|
7564
|
+
if (brandFont.isItalic) {
|
|
7565
|
+
chain = chain.setMark("italic");
|
|
7566
|
+
} else {
|
|
7567
|
+
chain = chain.unsetMark("italic");
|
|
7568
|
+
}
|
|
7569
|
+
chain.setTextSelection({ from, to }).focus().run();
|
|
7570
|
+
}
|
|
7377
7571
|
forceUpdate((n) => n + 1);
|
|
7378
|
-
}, [tiptapEditor]);
|
|
7572
|
+
}, [tiptapEditor, brandFonts]);
|
|
7379
7573
|
const handleDelete = () => {
|
|
7380
7574
|
if (focusIdx) {
|
|
7381
7575
|
deleteElement(focusIdx);
|
|
@@ -8543,7 +8737,7 @@ var ButtonToolbar = () => {
|
|
|
8543
8737
|
className: "shadow-none transition-none cursor-pointer",
|
|
8544
8738
|
size: "icon",
|
|
8545
8739
|
onClick: handleCycleButtonAlign,
|
|
8546
|
-
children: /* @__PURE__ */ jsx52("img", { src: ALIGNMENT_ICONS[currentButtonAlign], alt: "Align", className: "w-4 h-4" })
|
|
8740
|
+
children: /* @__PURE__ */ jsx52("img", { src: ALIGNMENT_ICONS[currentButtonAlign], alt: "Align", className: "w-4 h-4 dark:invert" })
|
|
8547
8741
|
}
|
|
8548
8742
|
) }),
|
|
8549
8743
|
/* @__PURE__ */ jsx52(TooltipContent, { side: "bottom", children: "Align" })
|
|
@@ -9741,14 +9935,10 @@ var SocialToolbar = () => {
|
|
|
9741
9935
|
className: "shadow-none transition-none cursor-pointer",
|
|
9742
9936
|
size: "icon",
|
|
9743
9937
|
onClick: handleCycleAlign,
|
|
9744
|
-
children: /* @__PURE__ */ jsx61("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4" })
|
|
9938
|
+
children: /* @__PURE__ */ jsx61("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4 dark:invert" })
|
|
9745
9939
|
}
|
|
9746
9940
|
) }),
|
|
9747
|
-
/* @__PURE__ */
|
|
9748
|
-
"Align (",
|
|
9749
|
-
currentAlign,
|
|
9750
|
-
")"
|
|
9751
|
-
] })
|
|
9941
|
+
/* @__PURE__ */ jsx61(TooltipContent, { side: "bottom", className: "z-51", children: "Align" })
|
|
9752
9942
|
] })
|
|
9753
9943
|
] })
|
|
9754
9944
|
] });
|
|
@@ -10318,7 +10508,7 @@ var DividerToolbar = () => {
|
|
|
10318
10508
|
className: "shadow-none transition-none cursor-pointer",
|
|
10319
10509
|
size: "icon",
|
|
10320
10510
|
onClick: handleCycleAlign,
|
|
10321
|
-
children: /* @__PURE__ */ jsx64("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4" })
|
|
10511
|
+
children: /* @__PURE__ */ jsx64("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4 dark:invert" })
|
|
10322
10512
|
}
|
|
10323
10513
|
) }),
|
|
10324
10514
|
/* @__PURE__ */ jsx64(TooltipContent, { side: "bottom", className: "z-51", children: "Align" })
|
|
@@ -10431,7 +10621,7 @@ var ImageToolbar = () => {
|
|
|
10431
10621
|
className: "shadow-none transition-none cursor-pointer",
|
|
10432
10622
|
size: "icon",
|
|
10433
10623
|
onClick: handleCycleAlign,
|
|
10434
|
-
children: /* @__PURE__ */ jsx65("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4" })
|
|
10624
|
+
children: /* @__PURE__ */ jsx65("img", { src: ALIGNMENT_ICONS[currentAlign], alt: "Align", className: "w-4 h-4 dark:invert" })
|
|
10435
10625
|
}
|
|
10436
10626
|
) }),
|
|
10437
10627
|
/* @__PURE__ */ jsx65(TooltipContent, { side: "bottom", children: "Align" })
|
|
@@ -11708,7 +11898,7 @@ function useAutoSave() {
|
|
|
11708
11898
|
// src/core/editor/components/email-template-v2/template-page.tsx
|
|
11709
11899
|
import "react-json-view-lite/dist/index.css";
|
|
11710
11900
|
import { jsx as jsx74, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
11711
|
-
var Editor2 = lazy(() => import("./core-
|
|
11901
|
+
var Editor2 = lazy(() => import("./core-HIQH4BAG.mjs").then((module) => ({
|
|
11712
11902
|
default: module.Editor
|
|
11713
11903
|
})));
|
|
11714
11904
|
function TemplatePage({
|
|
@@ -11791,5 +11981,8 @@ export {
|
|
|
11791
11981
|
Editor,
|
|
11792
11982
|
MAX_TEMPLATE_SIZE,
|
|
11793
11983
|
TemplatePage,
|
|
11794
|
-
|
|
11984
|
+
campaign_validation_warnings,
|
|
11985
|
+
json2mjml,
|
|
11986
|
+
validate_campaign_onCreate,
|
|
11987
|
+
validate_editor_onPreview
|
|
11795
11988
|
};
|