@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.
@@ -330,6 +330,7 @@ type Variable = {
330
330
  required?: boolean;
331
331
  valid?: boolean;
332
332
  hideDefaultValue?: boolean;
333
+ label?: string;
333
334
  };
334
335
  type VariableFunctionOptions = {
335
336
  query: string;
@@ -388,6 +389,7 @@ type VariableListProps = {
388
389
  id: string;
389
390
  required: boolean;
390
391
  hideDefaultValue: boolean;
392
+ label?: string;
391
393
  }) => void;
392
394
  items: Variable[];
393
395
  } & SuggestionOptions;
@@ -396,6 +398,7 @@ declare const VariableList: react.ForwardRefExoticComponent<{
396
398
  id: string;
397
399
  required: boolean;
398
400
  hideDefaultValue: boolean;
401
+ label?: string;
399
402
  }) => void;
400
403
  items: Variable[];
401
404
  } & SuggestionOptions<any, any> & react.RefAttributes<unknown>>;
@@ -330,6 +330,7 @@ type Variable = {
330
330
  required?: boolean;
331
331
  valid?: boolean;
332
332
  hideDefaultValue?: boolean;
333
+ label?: string;
333
334
  };
334
335
  type VariableFunctionOptions = {
335
336
  query: string;
@@ -388,6 +389,7 @@ type VariableListProps = {
388
389
  id: string;
389
390
  required: boolean;
390
391
  hideDefaultValue: boolean;
392
+ label?: string;
391
393
  }) => void;
392
394
  items: Variable[];
393
395
  } & SuggestionOptions;
@@ -396,6 +398,7 @@ declare const VariableList: react.ForwardRefExoticComponent<{
396
398
  id: string;
397
399
  required: boolean;
398
400
  hideDefaultValue: boolean;
401
+ label?: string;
399
402
  }) => void;
400
403
  items: Variable[];
401
404
  } & SuggestionOptions<any, any> & react.RefAttributes<unknown>>;
@@ -4498,7 +4498,8 @@ function ImageView(props) {
4498
4498
  newHeight = IMAGE_MAX_HEIGHT;
4499
4499
  }
4500
4500
  if (node.attrs.lockAspectRatio) {
4501
- newHeight = getNewHeight(newWidth, node.attrs.aspectRatio);
4501
+ const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
4502
+ newHeight = getNewHeight(newWidth, aspectRatio);
4502
4503
  }
4503
4504
  setResizingStyle({ width: newWidth, height: newHeight });
4504
4505
  if (!event2.buttons) {
@@ -4674,8 +4675,8 @@ function ImageView(props) {
4674
4675
  "data-drag-handle": editor.isEditable,
4675
4676
  className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
4676
4677
  style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
4677
- width: width ? `${width}px` : void 0,
4678
- height: height ? `${height}px` : void 0
4678
+ width: width && width !== "auto" ? `${width}px` : void 0,
4679
+ height: height && height !== "auto" ? `${height}px` : void 0
4679
4680
  }, resizingStyle) : {}), {
4680
4681
  overflow: "hidden",
4681
4682
  position: "relative",
@@ -4727,8 +4728,8 @@ function ImageView(props) {
4727
4728
  objectFit: "fill",
4728
4729
  marginBottom: 0,
4729
4730
  borderRadius,
4730
- width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
4731
- height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
4731
+ width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
4732
+ height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
4732
4733
  }),
4733
4734
  draggable: editor.isEditable,
4734
4735
  className: cn(
@@ -5470,7 +5471,7 @@ function ColorPicker(props) {
5470
5471
  BaseButton,
5471
5472
  {
5472
5473
  variant: "ghost",
5473
- className: "!mly:size-7 mly:shrink-0",
5474
+ className: "mly:h-7 mly:w-7 mly:shrink-0",
5474
5475
  size: "sm",
5475
5476
  type: "button",
5476
5477
  children: /* @__PURE__ */ jsx13(
@@ -6601,7 +6602,7 @@ var VariableSuggestionsPopover = forwardRef7((props, ref) => {
6601
6602
  ),
6602
6603
  children: [
6603
6604
  /* @__PURE__ */ jsx28(Braces, { className: "mly:size-3 mly:stroke-[2.5] mly:text-rose-600" }),
6604
- item.name
6605
+ (item == null ? void 0 : item.label) || item.name
6605
6606
  ]
6606
6607
  },
6607
6608
  index
@@ -6639,7 +6640,13 @@ import { useMemo as useMemo4 } from "react";
6639
6640
  import { Fragment as Fragment3, jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
6640
6641
  function VariableView(props) {
6641
6642
  const { node, updateAttributes: updateAttributes2, editor } = props;
6642
- const { id, fallback, required, hideDefaultValue = false } = node.attrs;
6643
+ const {
6644
+ id,
6645
+ fallback,
6646
+ required,
6647
+ hideDefaultValue = false,
6648
+ label
6649
+ } = node.attrs;
6643
6650
  const renderVariable = useMemo4(() => {
6644
6651
  var _a, _b;
6645
6652
  const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
@@ -6658,7 +6665,12 @@ function VariableView(props) {
6658
6665
  },
6659
6666
  children: [
6660
6667
  /* @__PURE__ */ jsx29(PopoverTrigger, { children: renderVariable({
6661
- variable: { name: id, required, valid: true },
6668
+ variable: {
6669
+ name: id,
6670
+ required,
6671
+ valid: true,
6672
+ label
6673
+ },
6662
6674
  fallback,
6663
6675
  editor,
6664
6676
  from: "content-variable"
@@ -6720,11 +6732,12 @@ function VariableView(props) {
6720
6732
  }
6721
6733
  var DefaultRenderVariable = (props) => {
6722
6734
  const { variable, fallback, from } = props;
6723
- const { name, required, valid } = variable;
6735
+ const { name, required, valid, label } = variable;
6736
+ const variableLabel = label || name;
6724
6737
  if (from === "button-variable") {
6725
6738
  return /* @__PURE__ */ jsxs13("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: [
6726
6739
  /* @__PURE__ */ jsx29(Braces2, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
6727
- /* @__PURE__ */ jsx29("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: name })
6740
+ /* @__PURE__ */ jsx29("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
6728
6741
  ] });
6729
6742
  }
6730
6743
  if (from === "bubble-variable") {
@@ -6737,7 +6750,7 @@ var DefaultRenderVariable = (props) => {
6737
6750
  ),
6738
6751
  children: [
6739
6752
  /* @__PURE__ */ jsx29(Braces2, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
6740
- /* @__PURE__ */ jsx29("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: name })
6753
+ /* @__PURE__ */ jsx29("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
6741
6754
  ]
6742
6755
  }
6743
6756
  );
@@ -6749,7 +6762,7 @@ var DefaultRenderVariable = (props) => {
6749
6762
  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",
6750
6763
  children: [
6751
6764
  /* @__PURE__ */ jsx29(Braces2, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
6752
- name,
6765
+ variableLabel,
6753
6766
  required && !fallback && /* @__PURE__ */ jsx29(AlertTriangle, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]" })
6754
6767
  ]
6755
6768
  }
@@ -8665,7 +8678,8 @@ var VariableList = forwardRef9((props, ref) => {
8665
8678
  props.command({
8666
8679
  id: value.name,
8667
8680
  required: (_a2 = value.required) != null ? _a2 : true,
8668
- hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false
8681
+ hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false,
8682
+ label: value == null ? void 0 : value.label
8669
8683
  });
8670
8684
  },
8671
8685
  ref: popoverRef