@maily-to/core 0.0.24 → 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");
@@ -4381,13 +4381,17 @@ var useTextMenuState = (editor) => {
4381
4381
  const states = useEditorState6({
4382
4382
  editor,
4383
4383
  selector: (ctx) => {
4384
- var _a, _b, _c, _d, _e, _f;
4384
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4385
4385
  return {
4386
4386
  currentTextColor: ctx.editor.getAttributes("textStyle").color || DEFAULT_TEXT_COLOR,
4387
4387
  linkUrl: (_a = ctx.editor) == null ? void 0 : _a.getAttributes("link").href,
4388
4388
  textAlign: ((_b = ctx.editor) == null ? void 0 : _b.isActive({ textAlign: "left" })) ? "left" : ((_c = ctx.editor) == null ? void 0 : _c.isActive({ textAlign: "center" })) ? "center" : ((_d = ctx.editor) == null ? void 0 : _d.isActive({ textAlign: "right" })) ? "right" : ((_e = ctx.editor) == null ? void 0 : _e.isActive({ textAlign: "justify" })) ? "justify" : "left",
4389
4389
  isListActive: ctx.editor.isActive("bulletList") || ctx.editor.isActive("orderedList"),
4390
- isUrlVariable: (_f = ctx.editor.getAttributes("link").isUrlVariable) != null ? _f : false
4390
+ isUrlVariable: (_f = ctx.editor.getAttributes("link").isUrlVariable) != null ? _f : false,
4391
+ isHeadingActive: ctx.editor.isActive("heading"),
4392
+ headingShowIfKey: ((_g = ctx.editor.getAttributes("heading")) == null ? void 0 : _g.showIfKey) || "",
4393
+ isParagraphActive: ctx.editor.isActive("paragraph"),
4394
+ paragraphShowIfKey: ((_h = ctx.editor.getAttributes("paragraph")) == null ? void 0 : _h.showIfKey) || ""
4391
4395
  };
4392
4396
  },
4393
4397
  equalityFn: deepEql6
@@ -5735,22 +5739,22 @@ var ColumnsExtension = Node8.create({
5735
5739
  }
5736
5740
  });
5737
5741
 
5738
- // src/editor/nodes/for/for.ts
5742
+ // src/editor/nodes/repeat/repeat.ts
5739
5743
  import { mergeAttributes as mergeAttributes8, Node as Node9 } from "@tiptap/core";
5740
5744
  import { ReactNodeViewRenderer as ReactNodeViewRenderer6 } from "@tiptap/react";
5741
5745
 
5742
- // src/editor/nodes/for/for-view.tsx
5746
+ // src/editor/nodes/repeat/repeat-view.tsx
5743
5747
  import { NodeViewWrapper as NodeViewWrapper6, NodeViewContent } from "@tiptap/react";
5744
5748
  import { Repeat2 as Repeat22 } from "lucide-react";
5745
5749
  import { jsx as jsx42, jsxs as jsxs23 } from "react/jsx-runtime";
5746
- function ForView(props) {
5750
+ function RepeatView(props) {
5747
5751
  const { editor, getPos } = props;
5748
5752
  return /* @__PURE__ */ jsxs23(
5749
5753
  NodeViewWrapper6,
5750
5754
  {
5755
+ "data-type": "repeat",
5751
5756
  draggable: editor.isEditable,
5752
5757
  "data-drag-handle": editor.isEditable,
5753
- "data-type": "for",
5754
5758
  className: "mly-relative",
5755
5759
  children: [
5756
5760
  /* @__PURE__ */ jsx42(NodeViewContent, { className: "is-editable" }),
@@ -5775,9 +5779,9 @@ function ForView(props) {
5775
5779
  );
5776
5780
  }
5777
5781
 
5778
- // src/editor/nodes/for/for.ts
5779
- var ForExtension = Node9.create({
5780
- name: "for",
5782
+ // src/editor/nodes/repeat/repeat.ts
5783
+ var RepeatExtension = Node9.create({
5784
+ name: "repeat",
5781
5785
  group: "block",
5782
5786
  content: "(block|columns)+",
5783
5787
  draggable: true,
@@ -5835,7 +5839,7 @@ var ForExtension = Node9.create({
5835
5839
  },
5836
5840
  addCommands() {
5837
5841
  return {
5838
- setFor: () => ({ commands }) => {
5842
+ setRepeat: () => ({ commands }) => {
5839
5843
  return commands.insertContent({
5840
5844
  type: this.name,
5841
5845
  attrs: {},
@@ -5846,11 +5850,11 @@ var ForExtension = Node9.create({
5846
5850
  ]
5847
5851
  });
5848
5852
  },
5849
- updateFor: (attrs) => updateAttributes(this.name, attrs)
5853
+ updateRepeat: (attrs) => updateAttributes(this.name, attrs)
5850
5854
  };
5851
5855
  },
5852
5856
  addNodeView() {
5853
- return ReactNodeViewRenderer6(ForView, {
5857
+ return ReactNodeViewRenderer6(RepeatView, {
5854
5858
  contentDOMElementTag: "div",
5855
5859
  className: "mly-relative"
5856
5860
  });
@@ -6080,7 +6084,7 @@ function TextBubbleMenu(props) {
6080
6084
  return false;
6081
6085
  }
6082
6086
  const nestedNodes = [
6083
- ForExtension.name,
6087
+ RepeatExtension.name,
6084
6088
  SectionExtension.name,
6085
6089
  ColumnsExtension.name,
6086
6090
  ColumnExtension.name
@@ -6114,6 +6118,7 @@ function TextBubbleMenu(props) {
6114
6118
  const turnIntoBlockOptions = useTurnIntoBlockOptions(editor);
6115
6119
  const colors = editor == null ? void 0 : editor.storage.color.colors;
6116
6120
  const suggestedColors = (_c = (_b = (_a = Array == null ? void 0 : Array.from(colors)) == null ? void 0 : _a.reverse()) == null ? void 0 : _b.slice(0, 6)) != null ? _c : [];
6121
+ const showIfKey = (state == null ? void 0 : state.isHeadingActive) ? state == null ? void 0 : state.headingShowIfKey : state == null ? void 0 : state.paragraphShowIfKey;
6117
6122
  return /* @__PURE__ */ jsx44(
6118
6123
  BubbleMenu6,
6119
6124
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
@@ -6204,6 +6209,22 @@ function TextBubbleMenu(props) {
6204
6209
  }
6205
6210
  )
6206
6211
  }
6212
+ ),
6213
+ /* @__PURE__ */ jsx44(Divider, { className: "mly-mx-0" }),
6214
+ /* @__PURE__ */ jsx44(
6215
+ ShowPopover,
6216
+ {
6217
+ showIfKey,
6218
+ onShowIfKeyValueChange: (value) => {
6219
+ editor == null ? void 0 : editor.chain().updateAttributes(
6220
+ state.isHeadingActive ? "heading" : "paragraph",
6221
+ {
6222
+ showIfKey: value
6223
+ }
6224
+ ).run();
6225
+ },
6226
+ editor
6227
+ }
6207
6228
  )
6208
6229
  ] })
6209
6230
  })
@@ -6405,6 +6426,54 @@ var LinkExtension = TiptapLink.extend({
6405
6426
  }
6406
6427
  });
6407
6428
 
6429
+ // src/editor/nodes/heading/heading.ts
6430
+ import TiptapHeading from "@tiptap/extension-heading";
6431
+ var HeadingExtension = TiptapHeading.extend({
6432
+ addAttributes() {
6433
+ var _a;
6434
+ return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
6435
+ showIfKey: {
6436
+ default: DEFAULT_SECTION_SHOW_IF_KEY,
6437
+ parseHTML: (element) => {
6438
+ return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
6439
+ },
6440
+ renderHTML(attributes) {
6441
+ if (!attributes.showIfKey) {
6442
+ return {};
6443
+ }
6444
+ return {
6445
+ "data-show-if-key": attributes.showIfKey
6446
+ };
6447
+ }
6448
+ }
6449
+ });
6450
+ }
6451
+ });
6452
+
6453
+ // src/editor/nodes/paragraph/paragraph.ts
6454
+ import TiptapParagraph from "@tiptap/extension-paragraph";
6455
+ var ParagraphExtension = TiptapParagraph.extend({
6456
+ addAttributes() {
6457
+ var _a;
6458
+ return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
6459
+ showIfKey: {
6460
+ default: DEFAULT_SECTION_SHOW_IF_KEY,
6461
+ parseHTML: (element) => {
6462
+ return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
6463
+ },
6464
+ renderHTML(attributes) {
6465
+ if (!attributes.showIfKey) {
6466
+ return {};
6467
+ }
6468
+ return {
6469
+ "data-show-if-key": attributes.showIfKey
6470
+ };
6471
+ }
6472
+ }
6473
+ });
6474
+ }
6475
+ });
6476
+
6408
6477
  // src/editor/extensions/maily-kit.tsx
6409
6478
  var MailyKit = Extension.create({
6410
6479
  name: "maily-kit",
@@ -6426,12 +6495,6 @@ var MailyKit = Extension.create({
6426
6495
  content: "(block|columns)+"
6427
6496
  }),
6428
6497
  StarterKit.configure({
6429
- heading: {
6430
- levels: [1, 2, 3],
6431
- HTMLAttributes: {
6432
- class: "mly-relative"
6433
- }
6434
- },
6435
6498
  code: {
6436
6499
  HTMLAttributes: {
6437
6500
  class: "mly-px-1 mly-relative mly-py-0.5 mly-bg-[#efefef] mly-text-sm mly-rounded-md mly-tracking-normal mly-font-normal"
@@ -6442,11 +6505,6 @@ var MailyKit = Extension.create({
6442
6505
  class: "mly-not-prose mly-border-l-4 mly-border-gray-300 mly-pl-4 mly-mt-4 mly-mb-4 mly-relative"
6443
6506
  }
6444
6507
  },
6445
- paragraph: {
6446
- HTMLAttributes: {
6447
- class: "mly-relative"
6448
- }
6449
- },
6450
6508
  bulletList: {
6451
6509
  HTMLAttributes: {
6452
6510
  class: "mly-relative"
@@ -6457,6 +6515,8 @@ var MailyKit = Extension.create({
6457
6515
  class: "mly-relative"
6458
6516
  }
6459
6517
  },
6518
+ heading: false,
6519
+ paragraph: false,
6460
6520
  horizontalRule: false,
6461
6521
  dropcursor: false,
6462
6522
  document: false
@@ -6476,7 +6536,7 @@ var MailyKit = Extension.create({
6476
6536
  "columns",
6477
6537
  "column",
6478
6538
  "section",
6479
- "for",
6539
+ "repeat",
6480
6540
  "show",
6481
6541
  "blockquote"
6482
6542
  ].includes(node.type.name)) {
@@ -6492,13 +6552,24 @@ var MailyKit = Extension.create({
6492
6552
  color: "#555",
6493
6553
  width: 3,
6494
6554
  class: "ProseMirror-dropcursor"
6555
+ }),
6556
+ HeadingExtension.configure({
6557
+ levels: [1, 2, 3],
6558
+ HTMLAttributes: {
6559
+ class: "mly-relative"
6560
+ }
6561
+ }),
6562
+ ParagraphExtension.configure({
6563
+ HTMLAttributes: {
6564
+ class: "mly-relative"
6565
+ }
6495
6566
  })
6496
6567
  ];
6497
6568
  if (this.options.linkCard !== false) {
6498
6569
  extensions2.push(LinkCardExtension.configure(this.options.linkCard));
6499
6570
  }
6500
- if (this.options.for !== false) {
6501
- extensions2.push(ForExtension);
6571
+ if (this.options.repeat !== false) {
6572
+ extensions2.push(RepeatExtension);
6502
6573
  }
6503
6574
  if (this.options.section !== false) {
6504
6575
  extensions2.push(SectionExtension);
@@ -6752,6 +6823,24 @@ function extensions(props) {
6752
6823
  return [...defaultExtensions, ...extensions2];
6753
6824
  }
6754
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
+
6755
6844
  // src/editor/index.tsx
6756
6845
  import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
6757
6846
  function Editor9(props) {
@@ -6777,25 +6866,27 @@ function Editor9(props) {
6777
6866
  editable = true,
6778
6867
  placeholderUrl = DEFAULT_PLACEHOLDER_URL
6779
6868
  } = props;
6780
- let formattedContent = null;
6781
- if (contentJson) {
6782
- formattedContent = (contentJson == null ? void 0 : contentJson.type) === "doc" ? contentJson : {
6783
- type: "doc",
6784
- content: contentJson
6785
- };
6786
- } else if (contentHtml) {
6787
- formattedContent = contentHtml;
6788
- } else {
6789
- formattedContent = {
6790
- type: "doc",
6791
- content: [
6792
- {
6793
- type: "paragraph",
6794
- content: []
6795
- }
6796
- ]
6797
- };
6798
- }
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]);
6799
6890
  const menuContainerRef = useRef12(null);
6800
6891
  const editor = useEditor({
6801
6892
  editorProps: {
@@ -6867,7 +6958,7 @@ function Editor9(props) {
6867
6958
  /* @__PURE__ */ jsx47(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
6868
6959
  /* @__PURE__ */ jsx47(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
6869
6960
  /* @__PURE__ */ jsx47(ContentMenu, { editor }),
6870
- /* @__PURE__ */ jsx47(ForBubbleMenu, { editor, appendTo: menuContainerRef })
6961
+ /* @__PURE__ */ jsx47(RepeatBubbleMenu, { editor, appendTo: menuContainerRef })
6871
6962
  ]
6872
6963
  }
6873
6964
  )