@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.cjs
CHANGED
|
@@ -5648,7 +5648,8 @@ function ImageView(props) {
|
|
|
5648
5648
|
newHeight = IMAGE_MAX_HEIGHT;
|
|
5649
5649
|
}
|
|
5650
5650
|
if (node.attrs.lockAspectRatio) {
|
|
5651
|
-
|
|
5651
|
+
const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
|
|
5652
|
+
newHeight = getNewHeight(newWidth, aspectRatio);
|
|
5652
5653
|
}
|
|
5653
5654
|
setResizingStyle({ width: newWidth, height: newHeight });
|
|
5654
5655
|
if (!event2.buttons) {
|
|
@@ -5824,8 +5825,8 @@ function ImageView(props) {
|
|
|
5824
5825
|
"data-drag-handle": editor.isEditable,
|
|
5825
5826
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
5826
5827
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
5827
|
-
width: width ? `${width}px` : void 0,
|
|
5828
|
-
height: height ? `${height}px` : void 0
|
|
5828
|
+
width: width && width !== "auto" ? `${width}px` : void 0,
|
|
5829
|
+
height: height && height !== "auto" ? `${height}px` : void 0
|
|
5829
5830
|
}, resizingStyle) : {}), {
|
|
5830
5831
|
overflow: "hidden",
|
|
5831
5832
|
position: "relative",
|
|
@@ -5877,8 +5878,8 @@ function ImageView(props) {
|
|
|
5877
5878
|
objectFit: "fill",
|
|
5878
5879
|
marginBottom: 0,
|
|
5879
5880
|
borderRadius: borderRadius2,
|
|
5880
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
|
|
5881
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
|
|
5881
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
|
|
5882
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
|
|
5882
5883
|
}),
|
|
5883
5884
|
draggable: editor.isEditable,
|
|
5884
5885
|
className: cn(
|
|
@@ -7336,7 +7337,7 @@ var VariableSuggestionsPopover = (0, import_react25.forwardRef)((props, ref) =>
|
|
|
7336
7337
|
),
|
|
7337
7338
|
children: [
|
|
7338
7339
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react20.Braces, { className: "mly:size-3 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7339
|
-
item.name
|
|
7340
|
+
(item == null ? void 0 : item.label) || item.name
|
|
7340
7341
|
]
|
|
7341
7342
|
},
|
|
7342
7343
|
index
|
|
@@ -7374,7 +7375,13 @@ var import_react27 = require("react");
|
|
|
7374
7375
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7375
7376
|
function VariableView(props) {
|
|
7376
7377
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
7377
|
-
const {
|
|
7378
|
+
const {
|
|
7379
|
+
id,
|
|
7380
|
+
fallback,
|
|
7381
|
+
required,
|
|
7382
|
+
hideDefaultValue = false,
|
|
7383
|
+
label
|
|
7384
|
+
} = node.attrs;
|
|
7378
7385
|
const renderVariable = (0, import_react27.useMemo)(() => {
|
|
7379
7386
|
var _a, _b;
|
|
7380
7387
|
const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
|
|
@@ -7393,7 +7400,12 @@ function VariableView(props) {
|
|
|
7393
7400
|
},
|
|
7394
7401
|
children: [
|
|
7395
7402
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PopoverTrigger, { children: renderVariable({
|
|
7396
|
-
variable: {
|
|
7403
|
+
variable: {
|
|
7404
|
+
name: id,
|
|
7405
|
+
required,
|
|
7406
|
+
valid: true,
|
|
7407
|
+
label
|
|
7408
|
+
},
|
|
7397
7409
|
fallback,
|
|
7398
7410
|
editor,
|
|
7399
7411
|
from: "content-variable"
|
|
@@ -7455,11 +7467,12 @@ function VariableView(props) {
|
|
|
7455
7467
|
}
|
|
7456
7468
|
var DefaultRenderVariable = (props) => {
|
|
7457
7469
|
const { variable, fallback, from } = props;
|
|
7458
|
-
const { name, required, valid } = variable;
|
|
7470
|
+
const { name, required, valid, label } = variable;
|
|
7471
|
+
const variableLabel = label || name;
|
|
7459
7472
|
if (from === "button-variable") {
|
|
7460
7473
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("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: [
|
|
7461
7474
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react21.Braces, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
|
|
7462
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children:
|
|
7475
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
|
|
7463
7476
|
] });
|
|
7464
7477
|
}
|
|
7465
7478
|
if (from === "bubble-variable") {
|
|
@@ -7472,7 +7485,7 @@ var DefaultRenderVariable = (props) => {
|
|
|
7472
7485
|
),
|
|
7473
7486
|
children: [
|
|
7474
7487
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react21.Braces, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7475
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children:
|
|
7488
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
|
|
7476
7489
|
]
|
|
7477
7490
|
}
|
|
7478
7491
|
);
|
|
@@ -7484,7 +7497,7 @@ var DefaultRenderVariable = (props) => {
|
|
|
7484
7497
|
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",
|
|
7485
7498
|
children: [
|
|
7486
7499
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react21.Braces, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7487
|
-
|
|
7500
|
+
variableLabel,
|
|
7488
7501
|
required && !fallback && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react21.AlertTriangle, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]" })
|
|
7489
7502
|
]
|
|
7490
7503
|
}
|
|
@@ -7986,10 +7999,13 @@ function ImageBubbleMenu(props) {
|
|
|
7986
7999
|
const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
|
|
7987
8000
|
const currentHeight = Number(state.height) || 0;
|
|
7988
8001
|
const currentWidth = Number(state.width) || 0;
|
|
7989
|
-
const
|
|
8002
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8003
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8004
|
+
const isHeightAuto = !state.height || state.height === "auto";
|
|
8005
|
+
const shouldUpdateHeight = (lockAspectRatio || isHeightAuto) && value && (hasValidAspectRatio || currentHeight > 0);
|
|
7990
8006
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
7991
8007
|
width: String(width)
|
|
7992
|
-
},
|
|
8008
|
+
}, shouldUpdateHeight ? {
|
|
7993
8009
|
height: String(
|
|
7994
8010
|
getNewHeight(width, currentAspectRatio)
|
|
7995
8011
|
)
|
|
@@ -8006,10 +8022,13 @@ function ImageBubbleMenu(props) {
|
|
|
8006
8022
|
const height = Number(value) || 0;
|
|
8007
8023
|
const currentHeight = Number(state.height) || 0;
|
|
8008
8024
|
const currentWidth = Number(state.width) || 0;
|
|
8009
|
-
const
|
|
8025
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8026
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8027
|
+
const isWidthAuto = !state.width || state.width === "auto";
|
|
8028
|
+
const shouldUpdateWidth = (lockAspectRatio || isWidthAuto) && value && (hasValidAspectRatio || currentWidth > 0);
|
|
8010
8029
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8011
8030
|
height: String(height)
|
|
8012
|
-
},
|
|
8031
|
+
}, shouldUpdateWidth ? {
|
|
8013
8032
|
width: String(
|
|
8014
8033
|
getNewWidth(height, currentAspectRatio)
|
|
8015
8034
|
)
|
|
@@ -8135,8 +8154,8 @@ var InlineImageExtension = import_core8.Node.create({
|
|
|
8135
8154
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
8136
8155
|
const attrs = (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
8137
8156
|
"data-type": this.name,
|
|
8138
|
-
class: "mly:
|
|
8139
|
-
style:
|
|
8157
|
+
class: "mly:relative",
|
|
8158
|
+
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
8140
8159
|
draggable: "false",
|
|
8141
8160
|
loading: "lazy"
|
|
8142
8161
|
});
|
|
@@ -8562,7 +8581,7 @@ function ColorPicker(props) {
|
|
|
8562
8581
|
BaseButton,
|
|
8563
8582
|
{
|
|
8564
8583
|
variant: "ghost",
|
|
8565
|
-
className: "
|
|
8584
|
+
className: "mly:h-7 mly:w-7 mly:shrink-0",
|
|
8566
8585
|
size: "sm",
|
|
8567
8586
|
type: "button",
|
|
8568
8587
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -8859,7 +8878,7 @@ function SectionBubbleMenu(props) {
|
|
|
8859
8878
|
BaseButton,
|
|
8860
8879
|
{
|
|
8861
8880
|
variant: "ghost",
|
|
8862
|
-
className: "
|
|
8881
|
+
className: "mly:h-7 mly:w-7 mly:shrink-0",
|
|
8863
8882
|
size: "sm",
|
|
8864
8883
|
type: "button",
|
|
8865
8884
|
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
@@ -11232,7 +11251,8 @@ var VariableList = (0, import_react59.forwardRef)((props, ref) => {
|
|
|
11232
11251
|
props.command({
|
|
11233
11252
|
id: value.name,
|
|
11234
11253
|
required: (_a2 = value.required) != null ? _a2 : true,
|
|
11235
|
-
hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false
|
|
11254
|
+
hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false,
|
|
11255
|
+
label: value == null ? void 0 : value.label
|
|
11236
11256
|
});
|
|
11237
11257
|
},
|
|
11238
11258
|
ref: popoverRef
|