@maily-to/core 0.3.0 → 0.3.2

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/index.mjs CHANGED
@@ -6880,7 +6880,7 @@ function VariableIcon(props) {
6880
6880
  "div",
6881
6881
  {
6882
6882
  className: cn(
6883
- "mly-flex mly-size-5 mly-items-center mly-justify-center mly-rounded-md mly-border",
6883
+ "mly-flex mly-size-5 mly-items-center mly-justify-center mly-rounded-md mly-border mly-border-gray-200",
6884
6884
  className
6885
6885
  ),
6886
6886
  children
@@ -6892,15 +6892,19 @@ function VariableIcon(props) {
6892
6892
  import { NodeViewWrapper as NodeViewWrapper3 } from "@tiptap/react";
6893
6893
  import { AlertTriangle, Braces as Braces2, Pencil } from "lucide-react";
6894
6894
  import { useMemo as useMemo5 } from "react";
6895
- import { jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
6895
+ import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
6896
6896
  function VariableView(props) {
6897
6897
  const { node, updateAttributes: updateAttributes2, editor } = props;
6898
- const { id, fallback, required } = node.attrs;
6898
+ const { id, fallback, required, hideDefaultValue = false } = node.attrs;
6899
6899
  const renderVariable = useMemo5(() => {
6900
6900
  var _a, _b;
6901
6901
  const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
6902
6902
  return variableRender;
6903
6903
  }, [editor]);
6904
+ const disableInput = useMemo5(() => {
6905
+ var _a, _b;
6906
+ return (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.disableInput) != null ? _b : false;
6907
+ }, [editor]);
6904
6908
  return /* @__PURE__ */ jsx34(
6905
6909
  NodeViewWrapper3,
6906
6910
  {
@@ -6934,6 +6938,7 @@ function VariableView(props) {
6934
6938
  /* @__PURE__ */ jsx34(
6935
6939
  "input",
6936
6940
  __spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
6941
+ disabled: disableInput,
6937
6942
  value: id != null ? id : "",
6938
6943
  onChange: (e) => {
6939
6944
  updateAttributes2({
@@ -6941,27 +6946,29 @@ function VariableView(props) {
6941
6946
  });
6942
6947
  },
6943
6948
  placeholder: "ie. name...",
6944
- className: "mly-h-7 mly-w-36 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
6949
+ className: "mly-h-7 mly-w-36 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none disabled:mly-cursor-not-allowed"
6945
6950
  })
6946
6951
  )
6947
6952
  ] }),
6948
- /* @__PURE__ */ jsx34(Divider, { className: "mly-mx-1.5" }),
6949
- /* @__PURE__ */ jsxs16("label", { className: "mly-relative", children: [
6950
- /* @__PURE__ */ jsx34("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
6951
- /* @__PURE__ */ jsx34(
6952
- "input",
6953
- __spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
6954
- value: fallback != null ? fallback : "",
6955
- onChange: (e) => {
6956
- updateAttributes2({
6957
- fallback: e.target.value
6958
- });
6959
- },
6960
- placeholder: "ie. John Doe...",
6961
- className: "mly-h-7 mly-w-32 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
6962
- })
6963
- ),
6964
- /* @__PURE__ */ jsx34("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ jsx34(Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
6953
+ !hideDefaultValue && /* @__PURE__ */ jsxs16(Fragment4, { children: [
6954
+ /* @__PURE__ */ jsx34(Divider, { className: "mly-mx-1.5" }),
6955
+ /* @__PURE__ */ jsxs16("label", { className: "mly-relative", children: [
6956
+ /* @__PURE__ */ jsx34("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
6957
+ /* @__PURE__ */ jsx34(
6958
+ "input",
6959
+ __spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
6960
+ value: fallback != null ? fallback : "",
6961
+ onChange: (e) => {
6962
+ updateAttributes2({
6963
+ fallback: e.target.value
6964
+ });
6965
+ },
6966
+ placeholder: "ie. John Doe...",
6967
+ className: "mly-h-7 mly-w-32 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
6968
+ })
6969
+ ),
6970
+ /* @__PURE__ */ jsx34("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ jsx34(Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
6971
+ ] })
6965
6972
  ] })
6966
6973
  ] }) })
6967
6974
  }
@@ -7032,6 +7039,7 @@ var VariableExtension = Node4.create({
7032
7039
  variables: DEFAULT_VARIABLES,
7033
7040
  variableSuggestionsPopover: DEFAULT_VARIABLE_SUGGESTION_POPOVER,
7034
7041
  renderVariable: DEFAULT_RENDER_VARIABLE_FUNCTION,
7042
+ disableInput: false,
7035
7043
  renderLabel(props) {
7036
7044
  var _a;
7037
7045
  const { node } = props;
@@ -7115,6 +7123,9 @@ var VariableExtension = Node4.create({
7115
7123
  "data-required": (_a = attributes == null ? void 0 : attributes.required) != null ? _a : true
7116
7124
  };
7117
7125
  }
7126
+ },
7127
+ hideDefaultValue: {
7128
+ default: false
7118
7129
  }
7119
7130
  };
7120
7131
  },
@@ -7369,7 +7380,7 @@ var useImageState = (editor) => {
7369
7380
  };
7370
7381
 
7371
7382
  // src/editor/components/image-menu/image-bubble-menu.tsx
7372
- import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
7383
+ import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
7373
7384
  function ImageBubbleMenu(props) {
7374
7385
  var _a, _b, _c, _d;
7375
7386
  const { editor, appendTo } = props;
@@ -7399,7 +7410,7 @@ function ImageBubbleMenu(props) {
7399
7410
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
7400
7411
  className: "mly-flex mly-rounded-lg mly-border mly-border-gray-200 mly-bg-white mly-p-0.5 mly-shadow-md",
7401
7412
  children: /* @__PURE__ */ jsxs19(TooltipProvider, { children: [
7402
- state.isLogoActive && state.imageSrc && /* @__PURE__ */ jsxs19(Fragment4, { children: [
7413
+ state.isLogoActive && state.imageSrc && /* @__PURE__ */ jsxs19(Fragment5, { children: [
7403
7414
  /* @__PURE__ */ jsx37(
7404
7415
  Select,
7405
7416
  {
@@ -7471,7 +7482,7 @@ function ImageBubbleMenu(props) {
7471
7482
  }
7472
7483
  )
7473
7484
  ] }),
7474
- state.isImageActive && state.imageSrc && /* @__PURE__ */ jsxs19(Fragment4, { children: [
7485
+ state.isImageActive && state.imageSrc && /* @__PURE__ */ jsxs19(Fragment5, { children: [
7475
7486
  /* @__PURE__ */ jsx37(Divider, {}),
7476
7487
  /* @__PURE__ */ jsx37(
7477
7488
  Select,
@@ -8195,7 +8206,7 @@ var useSectionState = (editor) => {
8195
8206
  };
8196
8207
 
8197
8208
  // src/editor/components/section-menu/section-bubble-menu.tsx
8198
- import { Fragment as Fragment5, jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
8209
+ import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
8199
8210
  function SectionBubbleMenu(props) {
8200
8211
  const { appendTo, editor } = props;
8201
8212
  if (!editor) {
@@ -8431,7 +8442,7 @@ function SectionBubbleMenu(props) {
8431
8442
  editor
8432
8443
  }
8433
8444
  ),
8434
- state.isColumnsActive && /* @__PURE__ */ jsxs24(Fragment5, { children: [
8445
+ state.isColumnsActive && /* @__PURE__ */ jsxs24(Fragment6, { children: [
8435
8446
  /* @__PURE__ */ jsx44(Divider, {}),
8436
8447
  /* @__PURE__ */ jsxs24(Popover, { children: [
8437
8448
  /* @__PURE__ */ jsxs24(PopoverTrigger, { className: "mly-flex mly-items-center mly-gap-1 mly-rounded-md mly-px-1.5 mly-text-sm data-[state=open]:mly-bg-soft-gray hover:mly-bg-soft-gray", children: [
@@ -10260,7 +10271,7 @@ var SlashCommandExtension = Extension3.create({
10260
10271
  import { ReactRenderer } from "@tiptap/react";
10261
10272
  import {
10262
10273
  forwardRef as forwardRef8,
10263
- Fragment as Fragment7,
10274
+ Fragment as Fragment8,
10264
10275
  useCallback as useCallback11,
10265
10276
  useEffect as useEffect8,
10266
10277
  useImperativeHandle as useImperativeHandle2,
@@ -10273,7 +10284,7 @@ import tippy2 from "tippy.js";
10273
10284
  // src/editor/extensions/slash-command/slash-command-item.tsx
10274
10285
  import { ChevronRightIcon } from "lucide-react";
10275
10286
  import { useCallback as useCallback10, useState as useState10, useRef as useRef10, useEffect as useEffect7 } from "react";
10276
- import { Fragment as Fragment6, jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
10287
+ import { Fragment as Fragment7, jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
10277
10288
  function SlashCommandItem(props) {
10278
10289
  var _a;
10279
10290
  const {
@@ -10296,7 +10307,7 @@ function SlashCommandItem(props) {
10296
10307
  const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && (isHovered || isActive && !hoveredItemKey);
10297
10308
  const hasRenderFunction = typeof item.render === "function";
10298
10309
  const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
10299
- let value = /* @__PURE__ */ jsxs31(Fragment6, { children: [
10310
+ let value = /* @__PURE__ */ jsxs31(Fragment7, { children: [
10300
10311
  /* @__PURE__ */ jsx53("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
10301
10312
  /* @__PURE__ */ jsxs31("div", { className: "mly-grow", children: [
10302
10313
  /* @__PURE__ */ jsx53("p", { className: "mly-font-medium", children: item.title }),
@@ -10355,7 +10366,7 @@ function SlashCommandItem(props) {
10355
10366
  side: "right",
10356
10367
  sideOffset: 10,
10357
10368
  className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
10358
- children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ jsxs31(Fragment6, { children: [
10369
+ children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ jsxs31(Fragment7, { children: [
10359
10370
  /* @__PURE__ */ jsx53("figure", { className: "mly-relative mly-aspect-[2.5] mly-w-full mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200", children: /* @__PURE__ */ jsx53(
10360
10371
  "img",
10361
10372
  {
@@ -10598,7 +10609,7 @@ var CommandList = forwardRef8((props, ref) => {
10598
10609
  id: "slash-command",
10599
10610
  ref: commandListContainer,
10600
10611
  className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto",
10601
- children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs32(Fragment7, { children: [
10612
+ children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs32(Fragment8, { children: [
10602
10613
  /* @__PURE__ */ jsx54(
10603
10614
  "span",
10604
10615
  {
@@ -10754,10 +10765,11 @@ var VariableList = forwardRef9((props, ref) => {
10754
10765
  {
10755
10766
  items,
10756
10767
  onSelectItem: (value) => {
10757
- var _a2;
10768
+ var _a2, _b;
10758
10769
  props.command({
10759
10770
  id: value.name,
10760
- required: (_a2 = value.required) != null ? _a2 : true
10771
+ required: (_a2 = value.required) != null ? _a2 : true,
10772
+ hideDefaultValue: (_b = value == null ? void 0 : value.hideDefaultValue) != null ? _b : false
10761
10773
  });
10762
10774
  },
10763
10775
  ref: popoverRef
@@ -10971,7 +10983,7 @@ var useTextMenuState = (editor) => {
10971
10983
  };
10972
10984
 
10973
10985
  // src/editor/components/text-menu/text-bubble-content.tsx
10974
- import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
10986
+ import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
10975
10987
  function TextBubbleContent(props) {
10976
10988
  var _a, _b, _c, _d;
10977
10989
  const { editor, showListMenu = true } = props;
@@ -11015,7 +11027,7 @@ function TextBubbleContent(props) {
11015
11027
  tooltip: "Code"
11016
11028
  }
11017
11029
  ];
11018
- return /* @__PURE__ */ jsxs33(Fragment8, { children: [
11030
+ return /* @__PURE__ */ jsxs33(Fragment9, { children: [
11019
11031
  items.map((item, index) => /* @__PURE__ */ jsx56(BubbleMenuButton, __spreadValues({}, item), index)),
11020
11032
  /* @__PURE__ */ jsx56(
11021
11033
  AlignmentSwitch,
@@ -11026,7 +11038,7 @@ function TextBubbleContent(props) {
11026
11038
  }
11027
11039
  }
11028
11040
  ),
11029
- !state.isListActive && showListMenu && /* @__PURE__ */ jsxs33(Fragment8, { children: [
11041
+ !state.isListActive && showListMenu && /* @__PURE__ */ jsxs33(Fragment9, { children: [
11030
11042
  /* @__PURE__ */ jsx56(
11031
11043
  BubbleMenuButton,
11032
11044
  {