@maily-to/core 0.3.3 → 0.3.5
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/extensions/index.cjs +28 -14
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +3 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.mjs +28 -14
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +41 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -3
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +41 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -21
package/dist/index.mjs
CHANGED
|
@@ -5643,7 +5643,8 @@ function ImageView(props) {
|
|
|
5643
5643
|
newHeight = IMAGE_MAX_HEIGHT;
|
|
5644
5644
|
}
|
|
5645
5645
|
if (node.attrs.lockAspectRatio) {
|
|
5646
|
-
|
|
5646
|
+
const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
|
|
5647
|
+
newHeight = getNewHeight(newWidth, aspectRatio);
|
|
5647
5648
|
}
|
|
5648
5649
|
setResizingStyle({ width: newWidth, height: newHeight });
|
|
5649
5650
|
if (!event2.buttons) {
|
|
@@ -5819,8 +5820,8 @@ function ImageView(props) {
|
|
|
5819
5820
|
"data-drag-handle": editor.isEditable,
|
|
5820
5821
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
5821
5822
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
5822
|
-
width: width ? `${width}px` : void 0,
|
|
5823
|
-
height: height ? `${height}px` : void 0
|
|
5823
|
+
width: width && width !== "auto" ? `${width}px` : void 0,
|
|
5824
|
+
height: height && height !== "auto" ? `${height}px` : void 0
|
|
5824
5825
|
}, resizingStyle) : {}), {
|
|
5825
5826
|
overflow: "hidden",
|
|
5826
5827
|
position: "relative",
|
|
@@ -5872,8 +5873,8 @@ function ImageView(props) {
|
|
|
5872
5873
|
objectFit: "fill",
|
|
5873
5874
|
marginBottom: 0,
|
|
5874
5875
|
borderRadius: borderRadius2,
|
|
5875
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
|
|
5876
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
|
|
5876
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
|
|
5877
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
|
|
5877
5878
|
}),
|
|
5878
5879
|
draggable: editor.isEditable,
|
|
5879
5880
|
className: cn(
|
|
@@ -7361,7 +7362,7 @@ var VariableSuggestionsPopover = forwardRef5((props, ref) => {
|
|
|
7361
7362
|
),
|
|
7362
7363
|
children: [
|
|
7363
7364
|
/* @__PURE__ */ jsx33(Braces, { className: "mly:size-3 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7364
|
-
item.name
|
|
7365
|
+
(item == null ? void 0 : item.label) || item.name
|
|
7365
7366
|
]
|
|
7366
7367
|
},
|
|
7367
7368
|
index
|
|
@@ -7399,7 +7400,13 @@ import { useMemo as useMemo5 } from "react";
|
|
|
7399
7400
|
import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7400
7401
|
function VariableView(props) {
|
|
7401
7402
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
7402
|
-
const {
|
|
7403
|
+
const {
|
|
7404
|
+
id,
|
|
7405
|
+
fallback,
|
|
7406
|
+
required,
|
|
7407
|
+
hideDefaultValue = false,
|
|
7408
|
+
label
|
|
7409
|
+
} = node.attrs;
|
|
7403
7410
|
const renderVariable = useMemo5(() => {
|
|
7404
7411
|
var _a, _b;
|
|
7405
7412
|
const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
|
|
@@ -7418,7 +7425,12 @@ function VariableView(props) {
|
|
|
7418
7425
|
},
|
|
7419
7426
|
children: [
|
|
7420
7427
|
/* @__PURE__ */ jsx34(PopoverTrigger, { children: renderVariable({
|
|
7421
|
-
variable: {
|
|
7428
|
+
variable: {
|
|
7429
|
+
name: id,
|
|
7430
|
+
required,
|
|
7431
|
+
valid: true,
|
|
7432
|
+
label
|
|
7433
|
+
},
|
|
7422
7434
|
fallback,
|
|
7423
7435
|
editor,
|
|
7424
7436
|
from: "content-variable"
|
|
@@ -7480,11 +7492,12 @@ function VariableView(props) {
|
|
|
7480
7492
|
}
|
|
7481
7493
|
var DefaultRenderVariable = (props) => {
|
|
7482
7494
|
const { variable, fallback, from } = props;
|
|
7483
|
-
const { name, required, valid } = variable;
|
|
7495
|
+
const { name, required, valid, label } = variable;
|
|
7496
|
+
const variableLabel = label || name;
|
|
7484
7497
|
if (from === "button-variable") {
|
|
7485
7498
|
return /* @__PURE__ */ jsxs16("div", { className: "mly:inline-grid mly:max-w-xs mly:grid-cols-[12px_1fr] mly:items-center mly:gap-1.5 mly:rounded-md mly:border mly:border-(--button-var-border-color) mly:px-2 mly:py-px mly:font-mono mly:text-xs", children: [
|
|
7486
7499
|
/* @__PURE__ */ jsx34(Braces2, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
|
|
7487
|
-
/* @__PURE__ */ jsx34("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children:
|
|
7500
|
+
/* @__PURE__ */ jsx34("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
|
|
7488
7501
|
] });
|
|
7489
7502
|
}
|
|
7490
7503
|
if (from === "bubble-variable") {
|
|
@@ -7497,7 +7510,7 @@ var DefaultRenderVariable = (props) => {
|
|
|
7497
7510
|
),
|
|
7498
7511
|
children: [
|
|
7499
7512
|
/* @__PURE__ */ jsx34(Braces2, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7500
|
-
/* @__PURE__ */ jsx34("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children:
|
|
7513
|
+
/* @__PURE__ */ jsx34("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
|
|
7501
7514
|
]
|
|
7502
7515
|
}
|
|
7503
7516
|
);
|
|
@@ -7509,7 +7522,7 @@ var DefaultRenderVariable = (props) => {
|
|
|
7509
7522
|
className: "mly:inline-flex mly:items-center mly:gap-(--variable-icon-gap) mly:rounded-full mly:border mly:border-gray-200 mly:px-1.5 mly:py-0.5 mly:leading-none",
|
|
7510
7523
|
children: [
|
|
7511
7524
|
/* @__PURE__ */ jsx34(Braces2, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7512
|
-
|
|
7525
|
+
variableLabel,
|
|
7513
7526
|
required && !fallback && /* @__PURE__ */ jsx34(AlertTriangle, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]" })
|
|
7514
7527
|
]
|
|
7515
7528
|
}
|
|
@@ -8011,10 +8024,13 @@ function ImageBubbleMenu(props) {
|
|
|
8011
8024
|
const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
|
|
8012
8025
|
const currentHeight = Number(state.height) || 0;
|
|
8013
8026
|
const currentWidth = Number(state.width) || 0;
|
|
8014
|
-
const
|
|
8027
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8028
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8029
|
+
const isHeightAuto = !state.height || state.height === "auto";
|
|
8030
|
+
const shouldUpdateHeight = (lockAspectRatio || isHeightAuto) && value && (hasValidAspectRatio || currentHeight > 0);
|
|
8015
8031
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8016
8032
|
width: String(width)
|
|
8017
|
-
},
|
|
8033
|
+
}, shouldUpdateHeight ? {
|
|
8018
8034
|
height: String(
|
|
8019
8035
|
getNewHeight(width, currentAspectRatio)
|
|
8020
8036
|
)
|
|
@@ -8031,10 +8047,13 @@ function ImageBubbleMenu(props) {
|
|
|
8031
8047
|
const height = Number(value) || 0;
|
|
8032
8048
|
const currentHeight = Number(state.height) || 0;
|
|
8033
8049
|
const currentWidth = Number(state.width) || 0;
|
|
8034
|
-
const
|
|
8050
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8051
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8052
|
+
const isWidthAuto = !state.width || state.width === "auto";
|
|
8053
|
+
const shouldUpdateWidth = (lockAspectRatio || isWidthAuto) && value && (hasValidAspectRatio || currentWidth > 0);
|
|
8035
8054
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8036
8055
|
height: String(height)
|
|
8037
|
-
},
|
|
8056
|
+
}, shouldUpdateWidth ? {
|
|
8038
8057
|
width: String(
|
|
8039
8058
|
getNewWidth(height, currentAspectRatio)
|
|
8040
8059
|
)
|
|
@@ -8160,8 +8179,8 @@ var InlineImageExtension = Node5.create({
|
|
|
8160
8179
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
8161
8180
|
const attrs = mergeAttributes4(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
8162
8181
|
"data-type": this.name,
|
|
8163
|
-
class: "mly:
|
|
8164
|
-
style:
|
|
8182
|
+
class: "mly:relative",
|
|
8183
|
+
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
8165
8184
|
draggable: "false",
|
|
8166
8185
|
loading: "lazy"
|
|
8167
8186
|
});
|
|
@@ -8587,7 +8606,7 @@ function ColorPicker(props) {
|
|
|
8587
8606
|
BaseButton,
|
|
8588
8607
|
{
|
|
8589
8608
|
variant: "ghost",
|
|
8590
|
-
className: "
|
|
8609
|
+
className: "mly:h-7 mly:w-7 mly:shrink-0",
|
|
8591
8610
|
size: "sm",
|
|
8592
8611
|
type: "button",
|
|
8593
8612
|
children: /* @__PURE__ */ jsx43(
|
|
@@ -8884,7 +8903,7 @@ function SectionBubbleMenu(props) {
|
|
|
8884
8903
|
BaseButton,
|
|
8885
8904
|
{
|
|
8886
8905
|
variant: "ghost",
|
|
8887
|
-
className: "
|
|
8906
|
+
className: "mly:h-7 mly:w-7 mly:shrink-0",
|
|
8888
8907
|
size: "sm",
|
|
8889
8908
|
type: "button",
|
|
8890
8909
|
children: /* @__PURE__ */ jsx44(
|
|
@@ -11268,7 +11287,8 @@ var VariableList = forwardRef9((props, ref) => {
|
|
|
11268
11287
|
props.command({
|
|
11269
11288
|
id: value.name,
|
|
11270
11289
|
required: (_a2 = value.required) != null ? _a2 : true,
|
|
11271
|
-
hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false
|
|
11290
|
+
hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false,
|
|
11291
|
+
label: value == null ? void 0 : value.label
|
|
11272
11292
|
});
|
|
11273
11293
|
},
|
|
11274
11294
|
ref: popoverRef
|