@maily-to/core 0.0.25 → 0.0.26

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
@@ -54,7 +54,7 @@ function styleInject(css, { insertAt } = {}) {
54
54
  }
55
55
 
56
56
  // src/styles/index.css
57
- styleInject(':root {\n --placeholder-color: #adb5bd;\n --bg-color: #ffffff;\n --variable-icon-size: 12px;\n --variable-icon-gap: 4px;\n}\n.mly-editor .mly-prose p:where([class~=text-sm]) {\n font-size: 16px;\n}\n.mly-editor .mly-prose h1,\n.mly-editor .mly-prose h2,\n.mly-editor .mly-prose h3 {\n margin-top: 0;\n margin-bottom: 12px;\n}\n.mly-editor .mly-prose h1 {\n font-size: 36px;\n}\n.mly-editor .mly-prose h2 {\n font-size: 30px;\n}\n.mly-editor .mly-prose h3 {\n font-size: 24px;\n}\n.mly-editor .mly-prose p {\n font-size: 15px;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose h1 + p,\n.mly-editor .mly-prose h2 + p,\n.mly-editor .mly-prose h3 + p,\n.mly-editor .mly-prose hr + p,\n.mly-editor .mly-prose table + p {\n margin-top: 0;\n}\n.mly-editor .mly-prose ol,\n.mly-editor .mly-prose ul {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose li:not(:last-child) {\n margin-bottom: 8px;\n}\n.mly-editor .mly-prose li > p {\n margin: 0;\n}\n.mly-editor .mly-prose img,\n.mly-editor .mly-prose .node-logo {\n margin-top: 0;\n margin-bottom: 32px;\n}\n.mly-editor .mly-prose hr {\n margin-block: 32px;\n}\n.mly-editor .mly-prose .footer {\n display: block;\n font-size: 13px;\n margin-bottom: 20px;\n color: rgb(100, 116, 139);\n}\n.mly-editor .mly-prose .spacer + * {\n margin-top: 0;\n}\n.mly-editor .mly-prose p + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose blockquote + .spacer {\n margin-top: -16px;\n}\n.mly-editor .mly-prose h1 + .spacer,\n.mly-editor .mly-prose h2 + .spacer,\n.mly-editor .mly-prose h3 + .spacer {\n margin-top: -12px;\n}\n.mly-editor .mly-prose ol + .spacer,\n.mly-editor .mly-prose ul + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose img + .spacer,\n.mly-editor .mly-prose .node-logo + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose .node-button + .spacer,\n.mly-editor .mly-prose .node-linkCard + .spacer,\n.mly-editor .mly-prose footer + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose .node-button,\n.mly-editor .mly-prose .node-linkCard {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose .node-image {\n line-height: 0;\n margin-top: 0;\n margin-bottom: 32px;\n outline: none;\n}\n.mly-editor .mly-prose .node-image + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose code::before,\n.mly-editor .mly-prose code::after {\n content: none;\n}\n.mly-no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n.mly-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n.mly-editor .react-colorful__alpha {\n border-radius: 0;\n}\n.mly-editor .react-colorful__saturation,\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n border-radius: 8px;\n}\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n height: 16px;\n}\n.mly-editor .react-colorful__pointer {\n width: 16px;\n height: 16px;\n}\n.mly-editable .ProseMirror-selectednode::after {\n content: "";\n position: absolute;\n inset: -2px;\n pointer-events: none;\n border-radius: 6px;\n background: rgba(35, 131, 226, 0.14);\n}\n.mly-prose {\n strong {\n color: currentColor;\n }\n}\n.ProseMirror {\n position: relative;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0;\n &:focus {\n outline: none;\n }\n p {\n margin-top: 0;\n }\n h1 {\n --variable-icon-size: 28px;\n }\n h2 {\n --variable-icon-size: 24px;\n }\n h3 {\n --variable-icon-size: 20px;\n }\n h1,\n h2,\n h3 {\n --variable-icon-gap: 8px;\n }\n .is-editor-empty:first-child:not([data-type=columns], [data-type=section], ul, li, ol)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n .is-empty:not([data-type=columns], [data-type=section], ol, ul, li)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n [data-type=columns] .is-empty::before,\n [data-type=section] .is-empty::before {\n --l-threshold: 0.66;\n --diff: calc(var(--l-threshold) - l);\n color: oklch(from var(--bg-color) clamp(0.05, max(min(var(--diff) * infinity, 1), 0), 0.95) c h) !important;\n opacity: 0.6;\n }\n [data-type=columns] {\n display: flex;\n margin: 0;\n padding: 0;\n &.has-focus [data-type=column],\n &:hover [data-type=column] {\n outline: 1.5px solid #e9ecef;\n outline-style: dashed;\n }\n [data-type=column].has-focus {\n outline-style: solid;\n }\n }\n [data-type=column] {\n display: table-cell;\n flex-basis: 0;\n flex-grow: 1;\n overflow: auto;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n [data-type=section] {\n margin: 0;\n padding: 0;\n [data-type=section-cell] {\n padding: 0;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n [data-type=for] {\n [data-node-view-content] > div {\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n .node-for.has-focus [data-repeat-indicator] {\n opacity: 1;\n }\n [data-type=show] {\n [data-node-view-content] > div {\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n *:has(+ .ProseMirror-gapcursor) {\n margin-bottom: 0 !important;\n }\n .ProseMirror-gapcursor {\n &::after {\n border: 1.5px solid gray;\n width: 24px;\n }\n & + * {\n margin-top: 0 !important;\n }\n }\n}\n.hide-number-controls {\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &[type=number] {\n -moz-appearance: textfield;\n }\n}\n.hide-scrollbars {\n scrollbar-width: none;\n -ms-overflow-style: none;\n &::-webkit-scrollbar {\n display: none;\n }\n}\n');
57
+ styleInject(':root {\n --placeholder-color: #adb5bd;\n --bg-color: #ffffff;\n --variable-icon-size: 12px;\n --variable-icon-gap: 4px;\n}\n.mly-editor .mly-prose p:where([class~=text-sm]) {\n font-size: 16px;\n}\n.mly-editor .mly-prose h1,\n.mly-editor .mly-prose h2,\n.mly-editor .mly-prose h3 {\n margin-top: 0;\n margin-bottom: 12px;\n}\n.mly-editor .mly-prose h1 {\n font-size: 36px;\n}\n.mly-editor .mly-prose h2 {\n font-size: 30px;\n}\n.mly-editor .mly-prose h3 {\n font-size: 24px;\n}\n.mly-editor .mly-prose p {\n font-size: 15px;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose h1 + p,\n.mly-editor .mly-prose h2 + p,\n.mly-editor .mly-prose h3 + p,\n.mly-editor .mly-prose hr + p,\n.mly-editor .mly-prose table + p {\n margin-top: 0;\n}\n.mly-editor .mly-prose ol,\n.mly-editor .mly-prose ul {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose li:not(:last-child) {\n margin-bottom: 8px;\n}\n.mly-editor .mly-prose li > p {\n margin: 0;\n}\n.mly-editor .mly-prose img,\n.mly-editor .mly-prose .node-logo {\n margin-top: 0;\n margin-bottom: 32px;\n}\n.mly-editor .mly-prose hr {\n margin-block: 32px;\n}\n.mly-editor .mly-prose .footer {\n display: block;\n font-size: 13px;\n margin-bottom: 20px;\n color: rgb(100, 116, 139);\n}\n.mly-editor .mly-prose .spacer + * {\n margin-top: 0;\n}\n.mly-editor .mly-prose p + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose blockquote + .spacer {\n margin-top: -16px;\n}\n.mly-editor .mly-prose h1 + .spacer,\n.mly-editor .mly-prose h2 + .spacer,\n.mly-editor .mly-prose h3 + .spacer {\n margin-top: -12px;\n}\n.mly-editor .mly-prose ol + .spacer,\n.mly-editor .mly-prose ul + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose img + .spacer,\n.mly-editor .mly-prose .node-logo + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose .node-button + .spacer,\n.mly-editor .mly-prose .node-linkCard + .spacer,\n.mly-editor .mly-prose footer + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose .node-button,\n.mly-editor .mly-prose .node-linkCard {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose .node-image {\n line-height: 0;\n margin-top: 0;\n margin-bottom: 32px;\n outline: none;\n}\n.mly-editor .mly-prose .node-image + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose code::before,\n.mly-editor .mly-prose code::after {\n content: none;\n}\n.mly-no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n.mly-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n.mly-editor .react-colorful__alpha {\n border-radius: 0;\n}\n.mly-editor .react-colorful__saturation,\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n border-radius: 8px;\n}\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n height: 16px;\n}\n.mly-editor .react-colorful__pointer {\n width: 16px;\n height: 16px;\n}\n.mly-editable .ProseMirror-selectednode::after {\n content: "";\n position: absolute;\n inset: -2px;\n pointer-events: none;\n border-radius: 6px;\n background: rgba(35, 131, 226, 0.14);\n}\n.mly-prose {\n strong {\n color: currentColor;\n }\n}\n.ProseMirror {\n position: relative;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0;\n &:focus {\n outline: none;\n }\n p {\n margin-top: 0;\n }\n h1 {\n --variable-icon-size: 28px;\n }\n h2 {\n --variable-icon-size: 24px;\n }\n h3 {\n --variable-icon-size: 20px;\n }\n h1,\n h2,\n h3 {\n --variable-icon-gap: 8px;\n }\n .is-editor-empty:first-child:not([data-type=columns], [data-type=section], ul, li, ol)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n .is-empty:not([data-type=columns], [data-type=section], ol, ul, li)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n [data-type=columns] .is-empty::before,\n [data-type=section] .is-empty::before {\n --l-threshold: 0.66;\n --diff: calc(var(--l-threshold) - l);\n color: oklch(from var(--bg-color) clamp(0.05, max(min(var(--diff) * infinity, 1), 0), 0.95) c h) !important;\n opacity: 0.6;\n }\n [data-type=columns] {\n display: flex;\n margin: 0;\n padding: 0;\n &.has-focus [data-type=column],\n &:hover [data-type=column] {\n outline: 1.5px solid #e9ecef;\n outline-style: dashed;\n }\n [data-type=column].has-focus {\n outline-style: solid;\n }\n }\n [data-type=column] {\n display: table-cell;\n flex-basis: 0;\n flex-grow: 1;\n overflow: auto;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n [data-type=section] {\n margin: 0;\n padding: 0;\n [data-type=section-cell] {\n padding: 0;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n [data-type=repeat] {\n [data-node-view-content] > div {\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n .node-repeat.has-focus [data-repeat-indicator] {\n opacity: 1;\n }\n [data-type=show] {\n [data-node-view-content] > div {\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n *:has(+ .ProseMirror-gapcursor) {\n margin-bottom: 0 !important;\n }\n .ProseMirror-gapcursor {\n &::after {\n border: 1.5px solid gray;\n width: 24px;\n }\n & + * {\n margin-top: 0 !important;\n }\n }\n}\n.hide-number-controls {\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &[type=number] {\n -moz-appearance: textfield;\n }\n}\n.hide-scrollbars {\n scrollbar-width: none;\n -ms-overflow-style: none;\n &::-webkit-scrollbar {\n display: none;\n }\n}\n');
58
58
 
59
59
  // src/styles/preflight.css
60
60
  styleInject(':where(.mly-editor),\n:where(.mly-editor) ::before,\n:where(.mly-editor) ::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: #e5e7eb;\n}\n:where(.mly-editor) ::before,\n:where(.mly-editor) ::after {\n --tw-content: "";\n}\n:where(.mly-editor) html {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n font-family:\n ui-sans-serif,\n system-ui,\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-feature-settings: normal;\n font-variation-settings: normal;\n}\n:where(.mly-editor) body {\n margin: 0;\n line-height: inherit;\n}\n:where(.mly-editor) hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n}\n:where(.mly-editor) abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n:where(.mly-editor) h1,\n:where(.mly-editor) h2,\n:where(.mly-editor) h3,\n:where(.mly-editor) h4,\n:where(.mly-editor) h5,\n:where(.mly-editor) h6 {\n font-size: inherit;\n font-weight: inherit;\n}\n:where(.mly-editor) a {\n color: inherit;\n text-decoration: inherit;\n}\n:where(.mly-editor) b,\n:where(.mly-editor) strong {\n font-weight: bolder;\n}\n:where(.mly-editor) code,\n:where(.mly-editor) kbd,\n:where(.mly-editor) samp,\n:where(.mly-editor) pre {\n font-family:\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace;\n font-size: 1em;\n}\n:where(.mly-editor) small {\n font-size: 80%;\n}\n:where(.mly-editor) sub,\n:where(.mly-editor) sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n:where(.mly-editor) sub {\n bottom: -0.25em;\n}\n:where(.mly-editor) sup {\n top: -0.5em;\n}\n:where(.mly-editor) table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) input,\n:where(.mly-editor) optgroup,\n:where(.mly-editor) select,\n:where(.mly-editor) textarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) select {\n text-transform: none;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) [type=button],\n:where(.mly-editor) [type=reset],\n:where(.mly-editor) [type=submit] {\n -webkit-appearance: button;\n background-image: none;\n}\n:where(.mly-editor) :-moz-focusring {\n outline: auto;\n}\n:where(.mly-editor) :-moz-ui-invalid {\n box-shadow: none;\n}\n:where(.mly-editor) progress {\n vertical-align: baseline;\n}\n:where(.mly-editor) ::-webkit-inner-spin-button,\n:where(.mly-editor) ::-webkit-outer-spin-button {\n height: auto;\n}\n:where(.mly-editor) [type=search] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n:where(.mly-editor) ::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n:where(.mly-editor) ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n:where(.mly-editor) summary {\n display: list-item;\n}\n:where(.mly-editor) blockquote,\n:where(.mly-editor) dl,\n:where(.mly-editor) dd,\n:where(.mly-editor) h1,\n:where(.mly-editor) h2,\n:where(.mly-editor) h3,\n:where(.mly-editor) h4,\n:where(.mly-editor) h5,\n:where(.mly-editor) h6,\n:where(.mly-editor) hr,\n:where(.mly-editor) figure,\n:where(.mly-editor) p,\n:where(.mly-editor) pre {\n margin: 0;\n}\n:where(.mly-editor) fieldset {\n margin: 0;\n padding: 0;\n}\n:where(.mly-editor) legend {\n padding: 0;\n}\n:where(.mly-editor) ol,\n:where(.mly-editor) ul,\n:where(.mly-editor) menu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n:where(.mly-editor) dialog {\n padding: 0;\n}\n:where(.mly-editor) textarea {\n resize: vertical;\n}\n:where(.mly-editor) input::-moz-placeholder,\n:where(.mly-editor) textarea::-moz-placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n:where(.mly-editor) input::placeholder,\n:where(.mly-editor) textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) [role=button] {\n cursor: pointer;\n}\n:where(.mly-editor) :disabled {\n cursor: default;\n}\n:where(.mly-editor) img,\n:where(.mly-editor) svg,\n:where(.mly-editor) video,\n:where(.mly-editor) canvas,\n:where(.mly-editor) audio,\n:where(.mly-editor) iframe,\n:where(.mly-editor) embed,\n:where(.mly-editor) object {\n display: block;\n vertical-align: middle;\n}\n:where(.mly-editor) img,\n:where(.mly-editor) video {\n max-width: 100%;\n height: auto;\n}\n:where(.mly-editor) [hidden] {\n display: none;\n}\n');
@@ -64,7 +64,7 @@ styleInject('*,\n::before,\n::after {\n --tw-border-spacing-x: 0;\n --tw-borde
64
64
 
65
65
  // src/editor/index.tsx
66
66
  import { EditorContent, useEditor } from "@tiptap/react";
67
- import { useRef as useRef12 } from "react";
67
+ import { useMemo as useMemo9, useRef as useRef12 } from "react";
68
68
 
69
69
  // src/editor/components/column-menu/columns-bubble-menu.tsx
70
70
  import { BubbleMenu } from "@tiptap/react";
@@ -936,16 +936,16 @@ var section = {
936
936
  editor.chain().focus().deleteRange(range).setSection().run();
937
937
  }
938
938
  };
939
- var forLoop = {
940
- title: "For",
939
+ var repeat = {
940
+ title: "Repeat",
941
941
  description: "Loop over an array of items.",
942
- searchTerms: ["for", "loop"],
942
+ searchTerms: ["repeat", "for", "loop"],
943
943
  icon: /* @__PURE__ */ jsx11(Repeat2, { className: "mly-h-4 mly-w-4" }),
944
944
  shouldBeHidden: (editor) => {
945
- return editor.isActive("for");
945
+ return editor.isActive("repeat");
946
946
  },
947
947
  command: ({ editor, range }) => {
948
- editor.chain().focus().deleteRange(range).setFor().run();
948
+ editor.chain().focus().deleteRange(range).setRepeat().run();
949
949
  }
950
950
  };
951
951
  var spacer = {
@@ -1086,7 +1086,7 @@ var DEFAULT_SLASH_COMMANDS = [
1086
1086
  logo,
1087
1087
  columns,
1088
1088
  section,
1089
- forLoop,
1089
+ repeat,
1090
1090
  divider,
1091
1091
  spacer,
1092
1092
  button,
@@ -1665,7 +1665,7 @@ function ColumnsBubbleMenu(props) {
1665
1665
  }, [editor]);
1666
1666
  const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
1667
1667
  shouldShow: ({ editor: editor2 }) => {
1668
- if (isTextSelected(editor2) || editor2.isActive("section") || editor2.isActive("for") || !editor2.isEditable) {
1668
+ if (isTextSelected(editor2) || editor2.isActive("section") || editor2.isActive("repeat") || !editor2.isEditable) {
1669
1669
  return false;
1670
1670
  }
1671
1671
  return editor2.isActive("columns");
@@ -2406,7 +2406,7 @@ var EditorMenuBar = (props) => {
2406
2406
  );
2407
2407
  };
2408
2408
 
2409
- // src/editor/components/for-menu/for-bubble-menu.tsx
2409
+ // src/editor/components/repeat-menu/repeat-bubble-menu.tsx
2410
2410
  import { BubbleMenu as BubbleMenu2, findChildren } from "@tiptap/react";
2411
2411
  import {
2412
2412
  InfoIcon
@@ -2414,17 +2414,17 @@ import {
2414
2414
  import { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
2415
2415
  import { sticky as sticky2 } from "tippy.js";
2416
2416
 
2417
- // src/editor/components/for-menu/use-for-state.ts
2417
+ // src/editor/components/repeat-menu/use-repeat-state.ts
2418
2418
  import { useEditorState as useEditorState2 } from "@tiptap/react";
2419
2419
  import deepEql2 from "fast-deep-equal";
2420
- var useForState = (editor) => {
2420
+ var useRepeatState = (editor) => {
2421
2421
  const states = useEditorState2({
2422
2422
  editor,
2423
2423
  selector: (ctx) => {
2424
2424
  var _a, _b;
2425
2425
  return {
2426
- each: (_a = ctx.editor.getAttributes("for")) == null ? void 0 : _a.each,
2427
- currentShowIfKey: ((_b = ctx.editor.getAttributes("for")) == null ? void 0 : _b.showIfKey) || "",
2426
+ each: (_a = ctx.editor.getAttributes("repeat")) == null ? void 0 : _a.each,
2427
+ currentShowIfKey: ((_b = ctx.editor.getAttributes("repeat")) == null ? void 0 : _b.showIfKey) || "",
2428
2428
  isSectionActive: ctx.editor.isActive("section")
2429
2429
  };
2430
2430
  },
@@ -2433,23 +2433,23 @@ var useForState = (editor) => {
2433
2433
  return states;
2434
2434
  };
2435
2435
 
2436
- // src/editor/components/for-menu/for-bubble-menu.tsx
2436
+ // src/editor/components/repeat-menu/repeat-bubble-menu.tsx
2437
2437
  import { jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
2438
- function ForBubbleMenu(props) {
2438
+ function RepeatBubbleMenu(props) {
2439
2439
  const { appendTo, editor } = props;
2440
2440
  if (!editor) {
2441
2441
  return null;
2442
2442
  }
2443
- const state = useForState(editor);
2443
+ const state = useRepeatState(editor);
2444
2444
  const getReferenceClientRect = useCallback4(() => {
2445
- const renderContainer = getRenderContainer(editor, "for");
2445
+ const renderContainer = getRenderContainer(editor, "repeat");
2446
2446
  const rect = (renderContainer == null ? void 0 : renderContainer.getBoundingClientRect()) || new DOMRect(-1e3, -1e3, 0, 0);
2447
2447
  return rect;
2448
2448
  }, [editor]);
2449
2449
  const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
2450
2450
  shouldShow: ({ editor: editor2 }) => {
2451
2451
  var _a;
2452
- const activeForNode = getClosestNodeByName(editor2, "for");
2452
+ const activeForNode = getClosestNodeByName(editor2, "repeat");
2453
2453
  const sectionNodeChildren = activeForNode ? (_a = findChildren(activeForNode == null ? void 0 : activeForNode.node, (node) => {
2454
2454
  return node.type.name === "section";
2455
2455
  })) == null ? void 0 : _a[0] : null;
@@ -2457,7 +2457,7 @@ function ForBubbleMenu(props) {
2457
2457
  if (isTextSelected(editor2) || hasActiveSectionNodeChildren || !editor2.isEditable) {
2458
2458
  return false;
2459
2459
  }
2460
- return editor2.isActive("for");
2460
+ return editor2.isActive("repeat");
2461
2461
  },
2462
2462
  tippyOptions: {
2463
2463
  offset: [0, 8],
@@ -2470,7 +2470,7 @@ function ForBubbleMenu(props) {
2470
2470
  sticky: "popper",
2471
2471
  maxWidth: "auto"
2472
2472
  },
2473
- pluginKey: "forBubbleMenu"
2473
+ pluginKey: "repeatBubbleMenu"
2474
2474
  });
2475
2475
  const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
2476
2476
  const inputRef = useRef5(null);
@@ -2480,7 +2480,7 @@ function ForBubbleMenu(props) {
2480
2480
  return processVariables(variables, {
2481
2481
  query: eachKey || "",
2482
2482
  editor,
2483
- from: "for-variable"
2483
+ from: "repeat-variable"
2484
2484
  }).map((variable) => variable.name);
2485
2485
  }, [variables, eachKey, editor]);
2486
2486
  const isValidEachKey = eachKey;
@@ -2490,7 +2490,7 @@ function ForBubbleMenu(props) {
2490
2490
  className: "mly-flex mly-items-stretch mly-rounded-lg mly-border mly-border-slate-200 mly-bg-white mly-p-0.5 mly-shadow-md",
2491
2491
  children: /* @__PURE__ */ jsxs10(TooltipProvider, { children: [
2492
2492
  /* @__PURE__ */ jsxs10("div", { className: "mly-flex mly-items-center mly-gap-1.5 mly-px-1.5 mly-text-sm mly-leading-none", children: [
2493
- "For",
2493
+ "Repeat",
2494
2494
  /* @__PURE__ */ jsxs10(Tooltip, { children: [
2495
2495
  /* @__PURE__ */ jsx24(TooltipTrigger, { children: /* @__PURE__ */ jsx24(
2496
2496
  InfoIcon,
@@ -2548,7 +2548,7 @@ function ForBubbleMenu(props) {
2548
2548
  placeholder: "ie. payload.items",
2549
2549
  value: (state == null ? void 0 : state.each) || "",
2550
2550
  onValueChange: (value) => {
2551
- editor.commands.updateFor({
2551
+ editor.commands.updateRepeat({
2552
2552
  each: value
2553
2553
  });
2554
2554
  },
@@ -2556,7 +2556,7 @@ function ForBubbleMenu(props) {
2556
2556
  setIsUpdatingKey(false);
2557
2557
  },
2558
2558
  onSelectOption: (value) => {
2559
- editor.commands.updateFor({
2559
+ editor.commands.updateRepeat({
2560
2560
  each: value
2561
2561
  });
2562
2562
  setIsUpdatingKey(false);
@@ -2573,7 +2573,7 @@ function ForBubbleMenu(props) {
2573
2573
  {
2574
2574
  showIfKey: state.currentShowIfKey,
2575
2575
  onShowIfKeyValueChange: (value) => {
2576
- editor.commands.updateFor({
2576
+ editor.commands.updateRepeat({
2577
2577
  showIfKey: value
2578
2578
  });
2579
2579
  },
@@ -3952,11 +3952,11 @@ function SectionBubbleMenu(props) {
3952
3952
  shouldShow: ({ editor: editor2 }) => {
3953
3953
  var _a;
3954
3954
  const activeSectionNode = getClosestNodeByName(editor2, "section");
3955
- const forNodeChildren = activeSectionNode ? (_a = findChildren2(activeSectionNode == null ? void 0 : activeSectionNode.node, (node) => {
3956
- return node.type.name === "for";
3955
+ const repeatNodeChildren = activeSectionNode ? (_a = findChildren2(activeSectionNode == null ? void 0 : activeSectionNode.node, (node) => {
3956
+ return node.type.name === "repeat";
3957
3957
  })) == null ? void 0 : _a[0] : null;
3958
- const hasActiveForNodeChildren = forNodeChildren && editor2.isActive("for");
3959
- if (isTextSelected(editor2) || hasActiveForNodeChildren || !editor2.isEditable) {
3958
+ const hasActiveRepeatNodeChildren = repeatNodeChildren && editor2.isActive("repeat");
3959
+ if (isTextSelected(editor2) || hasActiveRepeatNodeChildren || !editor2.isEditable) {
3960
3960
  return false;
3961
3961
  }
3962
3962
  return editor2.isActive("section");
@@ -5739,22 +5739,22 @@ var ColumnsExtension = Node8.create({
5739
5739
  }
5740
5740
  });
5741
5741
 
5742
- // src/editor/nodes/for/for.ts
5742
+ // src/editor/nodes/repeat/repeat.ts
5743
5743
  import { mergeAttributes as mergeAttributes8, Node as Node9 } from "@tiptap/core";
5744
5744
  import { ReactNodeViewRenderer as ReactNodeViewRenderer6 } from "@tiptap/react";
5745
5745
 
5746
- // src/editor/nodes/for/for-view.tsx
5746
+ // src/editor/nodes/repeat/repeat-view.tsx
5747
5747
  import { NodeViewWrapper as NodeViewWrapper6, NodeViewContent } from "@tiptap/react";
5748
5748
  import { Repeat2 as Repeat22 } from "lucide-react";
5749
5749
  import { jsx as jsx42, jsxs as jsxs23 } from "react/jsx-runtime";
5750
- function ForView(props) {
5750
+ function RepeatView(props) {
5751
5751
  const { editor, getPos } = props;
5752
5752
  return /* @__PURE__ */ jsxs23(
5753
5753
  NodeViewWrapper6,
5754
5754
  {
5755
+ "data-type": "repeat",
5755
5756
  draggable: editor.isEditable,
5756
5757
  "data-drag-handle": editor.isEditable,
5757
- "data-type": "for",
5758
5758
  className: "mly-relative",
5759
5759
  children: [
5760
5760
  /* @__PURE__ */ jsx42(NodeViewContent, { className: "is-editable" }),
@@ -5779,9 +5779,9 @@ function ForView(props) {
5779
5779
  );
5780
5780
  }
5781
5781
 
5782
- // src/editor/nodes/for/for.ts
5783
- var ForExtension = Node9.create({
5784
- name: "for",
5782
+ // src/editor/nodes/repeat/repeat.ts
5783
+ var RepeatExtension = Node9.create({
5784
+ name: "repeat",
5785
5785
  group: "block",
5786
5786
  content: "(block|columns)+",
5787
5787
  draggable: true,
@@ -5839,7 +5839,7 @@ var ForExtension = Node9.create({
5839
5839
  },
5840
5840
  addCommands() {
5841
5841
  return {
5842
- setFor: () => ({ commands }) => {
5842
+ setRepeat: () => ({ commands }) => {
5843
5843
  return commands.insertContent({
5844
5844
  type: this.name,
5845
5845
  attrs: {},
@@ -5850,11 +5850,11 @@ var ForExtension = Node9.create({
5850
5850
  ]
5851
5851
  });
5852
5852
  },
5853
- updateFor: (attrs) => updateAttributes(this.name, attrs)
5853
+ updateRepeat: (attrs) => updateAttributes(this.name, attrs)
5854
5854
  };
5855
5855
  },
5856
5856
  addNodeView() {
5857
- return ReactNodeViewRenderer6(ForView, {
5857
+ return ReactNodeViewRenderer6(RepeatView, {
5858
5858
  contentDOMElementTag: "div",
5859
5859
  className: "mly-relative"
5860
5860
  });
@@ -6084,7 +6084,7 @@ function TextBubbleMenu(props) {
6084
6084
  return false;
6085
6085
  }
6086
6086
  const nestedNodes = [
6087
- ForExtension.name,
6087
+ RepeatExtension.name,
6088
6088
  SectionExtension.name,
6089
6089
  ColumnsExtension.name,
6090
6090
  ColumnExtension.name
@@ -6536,7 +6536,7 @@ var MailyKit = Extension.create({
6536
6536
  "columns",
6537
6537
  "column",
6538
6538
  "section",
6539
- "for",
6539
+ "repeat",
6540
6540
  "show",
6541
6541
  "blockquote"
6542
6542
  ].includes(node.type.name)) {
@@ -6568,8 +6568,8 @@ var MailyKit = Extension.create({
6568
6568
  if (this.options.linkCard !== false) {
6569
6569
  extensions2.push(LinkCardExtension.configure(this.options.linkCard));
6570
6570
  }
6571
- if (this.options.for !== false) {
6572
- extensions2.push(ForExtension);
6571
+ if (this.options.repeat !== false) {
6572
+ extensions2.push(RepeatExtension);
6573
6573
  }
6574
6574
  if (this.options.section !== false) {
6575
6575
  extensions2.push(SectionExtension);
@@ -6823,6 +6823,24 @@ function extensions(props) {
6823
6823
  return [...defaultExtensions, ...extensions2];
6824
6824
  }
6825
6825
 
6826
+ // src/editor/utils/replace-deprecated.ts
6827
+ function replaceDeprecatedNode(json) {
6828
+ const stack = [json];
6829
+ while (stack.length) {
6830
+ const node = stack.pop();
6831
+ if (!node) {
6832
+ continue;
6833
+ }
6834
+ if (node.type === "for") {
6835
+ node.type = "repeat";
6836
+ }
6837
+ if (node.content) {
6838
+ stack.push(...node.content);
6839
+ }
6840
+ }
6841
+ return json;
6842
+ }
6843
+
6826
6844
  // src/editor/index.tsx
6827
6845
  import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
6828
6846
  function Editor9(props) {
@@ -6848,25 +6866,27 @@ function Editor9(props) {
6848
6866
  editable = true,
6849
6867
  placeholderUrl = DEFAULT_PLACEHOLDER_URL
6850
6868
  } = props;
6851
- let formattedContent = null;
6852
- if (contentJson) {
6853
- formattedContent = (contentJson == null ? void 0 : contentJson.type) === "doc" ? contentJson : {
6854
- type: "doc",
6855
- content: contentJson
6856
- };
6857
- } else if (contentHtml) {
6858
- formattedContent = contentHtml;
6859
- } else {
6860
- formattedContent = {
6861
- type: "doc",
6862
- content: [
6863
- {
6864
- type: "paragraph",
6865
- content: []
6866
- }
6867
- ]
6868
- };
6869
- }
6869
+ const formattedContent = useMemo9(() => {
6870
+ if (contentJson) {
6871
+ const json = (contentJson == null ? void 0 : contentJson.type) === "doc" ? contentJson : {
6872
+ type: "doc",
6873
+ content: contentJson
6874
+ };
6875
+ return replaceDeprecatedNode(json);
6876
+ } else if (contentHtml) {
6877
+ return contentHtml;
6878
+ } else {
6879
+ return {
6880
+ type: "doc",
6881
+ content: [
6882
+ {
6883
+ type: "paragraph",
6884
+ content: []
6885
+ }
6886
+ ]
6887
+ };
6888
+ }
6889
+ }, [contentHtml, contentJson]);
6870
6890
  const menuContainerRef = useRef12(null);
6871
6891
  const editor = useEditor({
6872
6892
  editorProps: {
@@ -6938,7 +6958,7 @@ function Editor9(props) {
6938
6958
  /* @__PURE__ */ jsx47(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
6939
6959
  /* @__PURE__ */ jsx47(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
6940
6960
  /* @__PURE__ */ jsx47(ContentMenu, { editor }),
6941
- /* @__PURE__ */ jsx47(ForBubbleMenu, { editor, appendTo: menuContainerRef })
6961
+ /* @__PURE__ */ jsx47(RepeatBubbleMenu, { editor, appendTo: menuContainerRef })
6942
6962
  ]
6943
6963
  }
6944
6964
  )