@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.
@@ -4586,7 +4586,8 @@ function ImageView(props) {
4586
4586
  newHeight = IMAGE_MAX_HEIGHT;
4587
4587
  }
4588
4588
  if (node.attrs.lockAspectRatio) {
4589
- newHeight = getNewHeight(newWidth, node.attrs.aspectRatio);
4589
+ const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
4590
+ newHeight = getNewHeight(newWidth, aspectRatio);
4590
4591
  }
4591
4592
  setResizingStyle({ width: newWidth, height: newHeight });
4592
4593
  if (!event2.buttons) {
@@ -4762,8 +4763,8 @@ function ImageView(props) {
4762
4763
  "data-drag-handle": editor.isEditable,
4763
4764
  className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
4764
4765
  style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
4765
- width: width ? `${width}px` : void 0,
4766
- height: height ? `${height}px` : void 0
4766
+ width: width && width !== "auto" ? `${width}px` : void 0,
4767
+ height: height && height !== "auto" ? `${height}px` : void 0
4767
4768
  }, resizingStyle) : {}), {
4768
4769
  overflow: "hidden",
4769
4770
  position: "relative",
@@ -4815,8 +4816,8 @@ function ImageView(props) {
4815
4816
  objectFit: "fill",
4816
4817
  marginBottom: 0,
4817
4818
  borderRadius,
4818
- width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
4819
- height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
4819
+ width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
4820
+ height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
4820
4821
  }),
4821
4822
  draggable: editor.isEditable,
4822
4823
  className: cn(
@@ -5558,7 +5559,7 @@ function ColorPicker(props) {
5558
5559
  BaseButton,
5559
5560
  {
5560
5561
  variant: "ghost",
5561
- className: "!mly:size-7 mly:shrink-0",
5562
+ className: "mly:h-7 mly:w-7 mly:shrink-0",
5562
5563
  size: "sm",
5563
5564
  type: "button",
5564
5565
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -6659,7 +6660,7 @@ var VariableSuggestionsPopover = (0, import_react17.forwardRef)((props, ref) =>
6659
6660
  ),
6660
6661
  children: [
6661
6662
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react13.Braces, { className: "mly:size-3 mly:stroke-[2.5] mly:text-rose-600" }),
6662
- item.name
6663
+ (item == null ? void 0 : item.label) || item.name
6663
6664
  ]
6664
6665
  },
6665
6666
  index
@@ -6697,7 +6698,13 @@ var import_react19 = require("react");
6697
6698
  var import_jsx_runtime29 = require("react/jsx-runtime");
6698
6699
  function VariableView(props) {
6699
6700
  const { node, updateAttributes: updateAttributes2, editor } = props;
6700
- const { id, fallback, required, hideDefaultValue = false } = node.attrs;
6701
+ const {
6702
+ id,
6703
+ fallback,
6704
+ required,
6705
+ hideDefaultValue = false,
6706
+ label
6707
+ } = node.attrs;
6701
6708
  const renderVariable = (0, import_react19.useMemo)(() => {
6702
6709
  var _a, _b;
6703
6710
  const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
@@ -6716,7 +6723,12 @@ function VariableView(props) {
6716
6723
  },
6717
6724
  children: [
6718
6725
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PopoverTrigger, { children: renderVariable({
6719
- variable: { name: id, required, valid: true },
6726
+ variable: {
6727
+ name: id,
6728
+ required,
6729
+ valid: true,
6730
+ label
6731
+ },
6720
6732
  fallback,
6721
6733
  editor,
6722
6734
  from: "content-variable"
@@ -6778,11 +6790,12 @@ function VariableView(props) {
6778
6790
  }
6779
6791
  var DefaultRenderVariable = (props) => {
6780
6792
  const { variable, fallback, from } = props;
6781
- const { name, required, valid } = variable;
6793
+ const { name, required, valid, label } = variable;
6794
+ const variableLabel = label || name;
6782
6795
  if (from === "button-variable") {
6783
6796
  return /* @__PURE__ */ (0, import_jsx_runtime29.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: [
6784
6797
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Braces, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
6785
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: name })
6798
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
6786
6799
  ] });
6787
6800
  }
6788
6801
  if (from === "bubble-variable") {
@@ -6795,7 +6808,7 @@ var DefaultRenderVariable = (props) => {
6795
6808
  ),
6796
6809
  children: [
6797
6810
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Braces, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
6798
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: name })
6811
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
6799
6812
  ]
6800
6813
  }
6801
6814
  );
@@ -6807,7 +6820,7 @@ var DefaultRenderVariable = (props) => {
6807
6820
  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",
6808
6821
  children: [
6809
6822
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Braces, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
6810
- name,
6823
+ variableLabel,
6811
6824
  required && !fallback && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.AlertTriangle, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]" })
6812
6825
  ]
6813
6826
  }
@@ -8714,7 +8727,8 @@ var VariableList = (0, import_react35.forwardRef)((props, ref) => {
8714
8727
  props.command({
8715
8728
  id: value.name,
8716
8729
  required: (_a2 = value.required) != null ? _a2 : true,
8717
- hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false
8730
+ hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false,
8731
+ label: value == null ? void 0 : value.label
8718
8732
  });
8719
8733
  },
8720
8734
  ref: popoverRef